package com.wenyu.wenyuyuedu.activity.homepage;

import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.support.v7.app.AppCompatActivity;
import android.text.Editable;
import android.text.Html;
import android.text.Selection;
import android.text.Spannable;
import android.text.TextWatcher;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.view.inputmethod.InputMethodManager;
import android.widget.AdapterView;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.PopupWindow;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;

import com.bumptech.glide.Glide;
import com.jingchen.pulltorefresh.PullToRefreshLayout;
import com.jingchen.pulltorefresh.PullableListView;
import com.tencent.mm.sdk.modelpay.PayReq;
import com.tencent.mm.sdk.openapi.IWXAPI;
import com.tencent.mm.sdk.openapi.WXAPIFactory;
import com.wenyu.wenyuyuedu.R;
import com.wenyu.wenyuyuedu.activity.LoginActivity;
import com.wenyu.wenyuyuedu.activity.circle.CircleFindDetailActivity;
import com.wenyu.wenyuyuedu.activity.circle.EditCircleActivity;
import com.wenyu.wenyuyuedu.activity.circle.ExamineCircleActivity;
import com.wenyu.wenyuyuedu.activity.personage.Help_FeedBack_Activity;
import com.wenyu.wenyuyuedu.activity.personage.MyPublishActivity;
import com.wenyu.wenyuyuedu.activity.personage.OtherPublishActivity;
import com.wenyu.wenyuyuedu.adapter.homepagefragment.AttentionHeadviewContentGridView;
import com.wenyu.wenyuyuedu.adapter.homepagefragment.AttentionPlaytourCountAdapter;
import com.wenyu.wenyuyuedu.adapter.homepagefragment.AttenttionDetailAdapter;
import com.wenyu.wenyuyuedu.bean.JudgeWhetherJoinBean;
import com.wenyu.wenyuyuedu.bean.WXPlayBean;
import com.wenyu.wenyuyuedu.bean.circle.JoinCircleBean;
import com.wenyu.wenyuyuedu.bean.homepager.CollectInvitaionBean;
import com.wenyu.wenyuyuedu.bean.homepager.DeleteCommentBean;
import com.wenyu.wenyuyuedu.bean.homepager.LikeBean;
import com.wenyu.wenyuyuedu.bean.homepager.MyAttentionInformBean;
import com.wenyu.wenyuyuedu.bean.homepager.NewAllAttentionBean;
import com.wenyu.wenyuyuedu.bean.homepager.PostCommentBean;
import com.wenyu.wenyuyuedu.bean.homepager.postDeleteBean;
import com.wenyu.wenyuyuedu.global.ApiWrapper;
import com.wenyu.wenyuyuedu.server.WXPlayServer;
import com.wenyu.wenyuyuedu.server.circle.JoinCircleServer;
import com.wenyu.wenyuyuedu.server.homepager.CollectInvitationServer;
import com.wenyu.wenyuyuedu.server.homepager.DeleteCommentServer;
import com.wenyu.wenyuyuedu.server.homepager.Home_AllAtten_Server;
import com.wenyu.wenyuyuedu.server.homepager.Homepage_All_Server;
import com.wenyu.wenyuyuedu.server.homepager.JudgeWhetherJoin;
import com.wenyu.wenyuyuedu.server.homepager.PostCommentServer;
import com.wenyu.wenyuyuedu.server.homepager.postDeleteServer;
import com.wenyu.wenyuyuedu.utils.AbSharedUtil;
import com.wenyu.wenyuyuedu.utils.DeleteHtml;
import com.wenyu.wenyuyuedu.utils.DensityUtil;
import com.wenyu.wenyuyuedu.utils.MyLinearLayout;
import com.wenyu.wenyuyuedu.utils.MyToast;
import com.wenyu.wenyuyuedu.utils.SharedConstants;
import com.wenyu.wenyuyuedu.utils.ShowHideJianPan;
import com.wenyu.wenyuyuedu.utils.StatusBarUtil;
import com.wenyu.wenyuyuedu.utils.TimeStyle;
import com.wenyu.wenyuyuedu.view.CircleImageView;
import com.wenyu.wenyuyuedu.view.NoScrollGridView;

import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import butterknife.ButterKnife;
import butterknife.InjectView;
import cn.sharesdk.onekeyshare.OnekeyShare;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;

import static anetwork.channel.http.NetworkSdkSetting.context;
import static com.wenyu.wenyuyuedu.R.id.image_er;
import static com.wenyu.wenyuyuedu.R.id.image_liu;
import static com.wenyu.wenyuyuedu.R.id.image_qi;
import static com.wenyu.wenyuyuedu.R.id.image_san;
import static com.wenyu.wenyuyuedu.R.id.image_si;
import static com.wenyu.wenyuyuedu.R.id.image_wu;
import static com.wenyu.wenyuyuedu.R.id.image_yi;

/*
* 首页--我的关注的详情页
* */
public class MyAttentionActivity extends AppCompatActivity implements View.OnClickListener {

    @InjectView(R.id.invitation_left)
    ImageView invitationLeft;
    @InjectView(R.id.invitation_from_content)
    TextView invitationFromContent;
    @InjectView(R.id.invetation_content_view)
    PullableListView invetationContentView;
    @InjectView(R.id.invetation_refresh_view)
    PullToRefreshLayout invetationRefreshView;
    @InjectView(R.id.tv_invitation_dialog)
    RelativeLayout tvInvitationDialog;
    @InjectView(R.id.ll_from)
    LinearLayout llFrom;
    private Intent intent;
    private Intent getIntent;
    /*帖子的id*/
    private String allattentionid;
    /*来自哪个圈子*/
    private String allattentiontitle;
    private ListView listView;
    private Activity activity;
    private View attention_headView;
    private AttentionHeadviewContentGridView attention_headview_content_gridview;
    private AttentionPlaytourCountAdapter attentionPlaytourCountAdapter;
    private AttenttionDetailAdapter attenttionDetailAdapter;
    private List<String> images;
    private String zanCount;
    private String reply_num;
    /*圈子的id*/
    private String object_id;
    private String token1;
    private String id;
    private String uidHuiFu;
    private String idHuiFu;
    private String idHuiFuItem;
    private String uidHuiFuItem;
    private String idHuiFuItem1;
    private InputMethodManager imm;
    private Dialog myEditTextDialog;
    private EditText etInvitation;
    private TextView tvInvitation;
    private EditText myItemEditText;
    private TextView myItemTextView;
    private String allattentionnickname;
    private String uidObject;
    private String uid;
    private NewAllAttentionBean.InfoBean info;
    private List<NewAllAttentionBean.InfoBean.GiveInfoBean> give_path;
    private List<NewAllAttentionBean.InfoBean.AllCommentBean> forumLzlReply1;
    private List<NewAllAttentionBean.InfoBean.ForumBookmarkBean> forumBookmark;
    private TextView nickName;
    private IWXAPI msgApi;
    private EditText costomMoney;
    private String pidId;
    private ImageView imageYi;
    private ImageView imageEr;
    private ImageView imageSan;
    private ImageView imageSi;
    private ImageView imageWu;
    private ImageView imageLiu;
    private ImageView imageQi;
    private LinearLayout lPlaytour;
    private MyLinearLayout my_linearlayout;
    private LinearLayout dianza_ll;
    private String user_uid;
    private TextView countLine;
    private String comment_uid;
    private String comment_id;
    private String content;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_my_attention);
        ButterKnife.inject(this);
        StatusBarUtil.setStatusBar(MyAttentionActivity.this, R.color.white);
        activity = MyAttentionActivity.this;
        msgApi = WXAPIFactory.createWXAPI(activity, "wx645768d32ba61b12", true);
        msgApi.registerApp("wx645768d32ba61b12");
        initView();
        initPulltoRefresh();
        initHeadView();
        attenttionDetailAdapter = new AttenttionDetailAdapter(MyAttentionActivity.this, allattentionnickname);
        listView.setAdapter(attenttionDetailAdapter);
        requesData();
    }

    /*初始化头布局*/
    private void initHeadView() {
        attention_headView = getLayoutInflater().inflate(R.layout.attention_detail_headview, null);
        initHeadViewControl();
        invetationContentView.addHeaderView(attention_headView);
        attention_headview_content_gridview = new AttentionHeadviewContentGridView(activity);
        /*设置头布局中内容的图片*/
        gridView.setAdapter(attention_headview_content_gridview);
        /*设置头布局中打赏人的头像*/
        attentionPlaytourCountAdapter = new AttentionPlaytourCountAdapter(activity);
        gvPlaytourContent.setAdapter(attentionPlaytourCountAdapter);
        /*点击内容中的图片放大*/
        gridView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
                intent.setClass(activity, InvitationDeatil_HeadViewGridView_Viewpager_Activity.class);
                intent.putStringArrayListExtra("imagesViewpager", (ArrayList<String>) imagesAll);
                AbSharedUtil.putInt(activity, SharedConstants.IMAGE_INDEX, i);
                startActivity(intent);
            }
        });


    }

    /*初始化头布局的控件*/
    ImageView invitationDown;
    ImageView invitationShare;
    ImageView invitationMessage;
    ImageView invitationZan;
    ImageView invitationDeity;
    CircleImageView invitationHead;
    TextView invitationPlaytour;
    TextView invitationNickName;
    TextView releaseTime;
    TextView invitationContent;
    TextView invitationShowPlaytour;
    NoScrollGridView gvPlaytourContent;
    TextView invitationCommentCount;
    TextView playtour;
    ImageView showZan;
    TextView sc;
    NoScrollGridView gridView;

    private void initHeadViewControl() {
        invitationDown = (ImageView) attention_headView.findViewById(R.id.invitation_down);
        invitationShare = (ImageView) attention_headView.findViewById(R.id.invitation_share);
        invitationMessage = (ImageView) attention_headView.findViewById(R.id.invitation_message);
        invitationZan = (ImageView) attention_headView.findViewById(R.id.invitation_zan);
        invitationDeity = (ImageView) attention_headView.findViewById(R.id.invitation_deity);
        invitationHead = (CircleImageView) attention_headView.findViewById(R.id.invitation_head);
        invitationPlaytour = (TextView) attention_headView.findViewById(R.id.invitation_playtour);
        invitationNickName = (TextView) attention_headView.findViewById(R.id.invitation_nickname);
        releaseTime = (TextView) attention_headView.findViewById(R.id.invitation_releasetime);
        invitationContent = (TextView) attention_headView.findViewById(R.id.invitation_content);
        invitationShowPlaytour = (TextView) attention_headView.findViewById(R.id.invitation_show_playtour);
        gvPlaytourContent = (NoScrollGridView) attention_headView.findViewById(R.id.gv_playtour_content);
        invitationCommentCount = (TextView) attention_headView.findViewById(R.id.invitation_comment_count);
        playtour = (TextView) attention_headView.findViewById(R.id.invitation_playtour);
        showZan = (ImageView) attention_headView.findViewById(R.id.invitation_show_zan);
        lPlaytour = (LinearLayout) attention_headView.findViewById(R.id.ll_playtour);
        imageYi = (ImageView) attention_headView.findViewById(image_yi);
        imageEr = (ImageView) attention_headView.findViewById(image_er);
        imageSan = (ImageView) attention_headView.findViewById(image_san);
        imageSi = (ImageView) attention_headView.findViewById(image_si);
        imageWu = (ImageView) attention_headView.findViewById(image_wu);
        imageLiu = (ImageView) attention_headView.findViewById(image_liu);
        imageQi = (ImageView) attention_headView.findViewById(image_qi);
        sc = (TextView) attention_headView.findViewById(R.id.invitation_show_content);
        gridView = (NoScrollGridView) attention_headView.findViewById(R.id.invitation_picture_content);
        my_linearlayout = (MyLinearLayout) attention_headView.findViewById(R.id.my_linearlayout);
        dianza_ll = (LinearLayout) attention_headView.findViewById(R.id.dianza_ll);
        countLine = (TextView) attention_headView.findViewById(R.id.tv_comment_count_line);
        invitationDown.setOnClickListener(this);
        invitationShare.setOnClickListener(this);
        invitationMessage.setOnClickListener(this);
        invitationZan.setOnClickListener(this);
        invitationHead.setOnClickListener(this);
        invitationPlaytour.setOnClickListener(this);
        /*头像的点击事件*/
        setHeadClicl();
        /*打赏头像的点击事件*/
        gvPlaytourContent.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
                String give_id = give_path.get(i).getGive_id();
                intent.setClass(activity, OtherPublishActivity.class);
                intent.putExtra("userid", give_id);
                startActivity(intent);
            }
        });
        /*为了实现长按复制*/
        invitationContent.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                invitationContent.setTextIsSelectable(true);
            }
        });
        invitationHead.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if (token == null || token.equals("")) {
                    MyToast.showToast(MyAttentionActivity.this, "登录后获取更多操作", Toast.LENGTH_SHORT);
                } else {
                    if (user_uid.equals(uid)) {
                        intent.setClass(activity, MyPublishActivity.class);
                        startActivity(intent);
                    } else {
                        intent.setClass(activity, OtherPublishActivity.class);
                        intent.putExtra("userid", uid);
                        startActivity(intent);
                    }
                }
            }
        });
    }

    /*给打赏头像的点击事件--最多显示7个头像*/
    private void setHeadClicl() {
        /*第一个*/
        imageYi.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if (token == null || token.equals("")) {
                    MyToast.showToast(activity, "登录后获取更多操作", Toast.LENGTH_SHORT);
                } else {
                    String give_id = give_pathAll.get(0).getGive_id();
                    if (user_uid.equals(give_id)) {
                        intent.setClass(activity, MyPublishActivity.class);
                        startActivity(intent);
                    } else {
                        intent.setClass(activity, OtherPublishActivity.class);
                        intent.putExtra("userid", give_id);
                        startActivity(intent);
                    }
                }

            }
        });
          /*第二个*/
        imageEr.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if (token == null || token.equals("")) {
                    MyToast.showToast(activity, "登录后获取更多操作", Toast.LENGTH_SHORT);
                } else {
                    String give_id = give_pathAll.get(1).getGive_id();
                    if (user_uid.equals(give_id)) {
                        intent.setClass(activity, MyPublishActivity.class);
                        startActivity(intent);
                    } else {
                        intent.setClass(activity, OtherPublishActivity.class);
                        intent.putExtra("userid", give_id);
                        startActivity(intent);
                    }
                }
            }
        });
          /*第三个*/
        imageSan.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if (token == null || token.equals("")) {
                    MyToast.showToast(activity, "登录后获取更多操作", Toast.LENGTH_SHORT);
                } else {
                    String give_id = give_pathAll.get(2).getGive_id();
                    if (user_uid.equals(give_id)) {
                        intent.setClass(activity, MyPublishActivity.class);
                        startActivity(intent);
                    } else {
                        intent.setClass(activity, OtherPublishActivity.class);
                        intent.putExtra("userid", give_id);
                        startActivity(intent);
                    }
                }
            }
        });
          /*第四个*/
        imageSi.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if (token == null || token.equals("")) {
                    MyToast.showToast(activity, "登录后获取更多操作", Toast.LENGTH_SHORT);
                } else {
                    String give_id = give_pathAll.get(3).getGive_id();
                    if (user_uid.equals(give_id)) {
                        intent.setClass(activity, MyPublishActivity.class);
                        startActivity(intent);
                    } else {
                        intent.setClass(activity, OtherPublishActivity.class);
                        intent.putExtra("userid", give_id);
                        startActivity(intent);
                    }
                }
            }
        });
          /*第五个*/
        imageWu.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if (token == null || token.equals("")) {
                    MyToast.showToast(activity, "登录后获取更多操作", Toast.LENGTH_SHORT);
                } else {
                    String give_id = give_pathAll.get(4).getGive_id();
                    if (user_uid.equals(give_id)) {
                        intent.setClass(activity, MyPublishActivity.class);
                        startActivity(intent);
                    } else {
                        intent.setClass(activity, OtherPublishActivity.class);
                        intent.putExtra("userid", give_id);
                        startActivity(intent);
                    }
                }
            }
        });
          /*第六个*/
        imageLiu.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if (token == null || token.equals("")) {
                    MyToast.showToast(activity, "登录后获取更多操作", Toast.LENGTH_SHORT);
                } else {
                    String give_id = give_pathAll.get(5).getGive_id();
                    if (user_uid.equals(give_id)) {
                        intent.setClass(activity, MyPublishActivity.class);
                        startActivity(intent);
                    } else {
                        intent.setClass(activity, OtherPublishActivity.class);
                        intent.putExtra("userid", give_id);
                        startActivity(intent);
                    }
                }
            }
        });
          /*第七个*/
        imageQi.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if (token == null || token.equals("")) {
                    MyToast.showToast(activity, "登录后获取更多操作", Toast.LENGTH_SHORT);
                } else {
                    String give_id = give_pathAll.get(6).getGive_id();
                    if (user_uid.equals(give_id)) {
                        intent.setClass(activity, MyPublishActivity.class);
                        startActivity(intent);
                    } else {
                        intent.setClass(activity, OtherPublishActivity.class);
                        intent.putExtra("userid", give_id);
                        startActivity(intent);
                    }
                }
            }
        });
    }

    /*填充打赏人的头像*/
    private List<String> path;

    private void fillPlaytourView() {
        path = new ArrayList<>();
        if (give_path != null) {
            for (int paths = 0; paths < give_path.size(); paths++) {
                String path1 = give_path.get(paths).getIcon_path();
                path.add(path1);
            }
        }
        if (path.size() > 7) {

        }
    }

    /*填充头布局数据*/
    private void fillHeadViewData() {
        if (activity != null) {
            Glide.with(activity)
                    .load(info.getAvatar().getPath())
                    .error(R.drawable.login_logo)
                    .into(invitationHead);
        }
        invitationNickName.setText(info.getMember().getNickname());
        String create_time = info.getCreate_time();
        String s = TimeStyle.publishTime(create_time);
        releaseTime.setText(s);
        content = info.getContent();
        if (content.equals("")) {
            invitationContent.setVisibility(View.GONE);
        } else {
            invitationContent.setText(info.getContent());
        }
        if (Integer.parseInt(reply_num) > 0) {
            invitationCommentCount.setVisibility(View.VISIBLE);
            invitationCommentCount.setText(reply_num + "条评论");
            countLine.setVisibility(View.VISIBLE);
        } else {
            countLine.setVisibility(View.GONE);
        }
        if (path.size() > 0) {
            invitationShowPlaytour.setText("等" + path.size() + "人赏");
            invitationShowPlaytour.setVisibility(View.VISIBLE);
        }
        int i = Integer.parseInt(zanCount);
        /*点赞*/
        showZan.setVisibility(i > 0 ? View.VISIBLE : View.GONE);

        if (i < 5) {
            invitationDeity.setVisibility(View.GONE);
            playtour.setVisibility(View.GONE);
            //showZan.setVisibility(View.INVISIBLE);
        } else {
            invitationDeity.setVisibility(View.VISIBLE);
            playtour.setVisibility(View.VISIBLE);
        }
        AlertLikeCount();
    }

    /*修改点赞的人数显示*/
    private List<String> zanCount1 = new ArrayList<>();
    private int sizes;

    private void AlertLikeCount() {
        if (forumBookmark != null) {
            for (int zan = 0; zan < forumBookmark.size(); zan++) {
                String nickname = forumBookmark.get(zan).getNickname();
                zanCount1.add(nickname);
                sizes = zanCount1.size();
            }
            if (forumBookmark.size() != 0) {
                int size = zanCount1.size() > 12 ? 12 : sizes;
                my_linearlayout.removeAllViews();
                for (int j = 0; j < size; j++) {
                    final TextView textView = new TextView(activity);
                    LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
                    params.setMargins(8, 3, 6, 4);
                    textView.setLayoutParams(params);
                    textView.setTextAppearance(activity, R.style.dianzanstyle);
                    textView.setTextSize(14);
                    textView.setTextColor(activity.getResources().getColor(R.color.dianzan_name));
                    textView.setTag(forumBookmark.get(j).getUid());
                    if (j != size - 1) {
                        textView.setText(zanCount1.get(j) + ",");
                    } else if (zanCount1.size() > 12) {
                        textView.setText("等" + zanCount1.size() + "人已赞");
                    } else {
                        textView.setText(zanCount1.get(j));
                    }
                    my_linearlayout.addView(textView);
                    textView.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View view) {
                            String tag = (String) textView.getTag();
                            int i = Integer.parseInt(tag);
                            if (token == null || token.equals("")) {
                                MyToast.showToast(activity, "登录后获取更多操作", Toast.LENGTH_SHORT);
                            } else {
                                if (user_uid.equals(tag)) {
                                    intent.setClass(activity, MyPublishActivity.class);
                                    startActivity(intent);
                                } else {
                                    intent.setClass(activity, OtherPublishActivity.class);
                                    intent.putExtra("userid", tag);
                                    startActivity(intent);
                                }
                            }
                        }
                    });
                }
            }
        }
    }

    /*初始化下拉刷新的控件*/
    private boolean isLoading = false;

    private void initPulltoRefresh() {
        listView = (ListView) invetationRefreshView.getPullableView();
        invetationRefreshView.setOnPullListener(new PullToRefreshLayout.OnPullListener() {
            @Override
            public void onRefresh(PullToRefreshLayout pullToRefreshLayout) {
                new Handler() {
                    public void handleMessage(Message msg) {
                        page = 1;
                        isLoading = false;
                        zanCount1.clear();
                        requesData();
                        //千万别忘了告诉控件刷新完毕了
                        invetationRefreshView.refreshFinish(PullToRefreshLayout.SUCCEED);
                    }
                }.sendEmptyMessageDelayed(0, 1000);
            }

            @Override
            public void onLoadMore(PullToRefreshLayout pullToRefreshLayout) {
                new Handler() {
                    public void handleMessage(Message msg) {
                        runOnUiThread(new java.lang.Runnable() {
                            @Override
                            public void run() {
                                page++;
                                isLoading = true;
                                //  attenttionDetailAdapter.clear();
                                //千万别忘了告诉控件刷新完毕了
                                zanCount1.clear();
                                requesData();
                                invetationRefreshView.refreshFinish(PullToRefreshLayout.SUCCEED);
                            }
                        });
                    }
                }.sendEmptyMessageDelayed(0, 1000);
            }
        });
        /*条目长按的点击事件---可以删除--可以举报*/
        invetationContentView.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
            @Override
            public boolean onItemLongClick(AdapterView<?> adapterView, View view, int i, long l) {
                /*评价中被举报人的id*/
                comment_uid = info.getAllComment().get(i - 1).getUid();
                /*被举报的对象id*/
                comment_id = info.getAllComment().get(i - 1).getId();
                if (user_uid.equals(comment_uid)) {
                    showPopUpWindow(view, i);
                } else {
                    showPopUpWindowJuBao(view, i);
                }

                return true;
            }
        });
        invetationContentView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
                JudeWheTherItemMessage(i);
            }
        });
    }

    /**
     * 显示举报的弹框
     */
    private PopupWindow popWindowJuBao;

    private void showPopUpWindowJuBao(final View view, final int i) {
        TextView window = new TextView(activity);
        window.setText("举报");
        window.setTextColor(getResources().getColor(R.color.white));
        int padding = DensityUtil.dip2px(activity, 10);
        int bottom = DensityUtil.dip2px(activity, 15);
        window.setPadding(padding, padding, padding, bottom);
        window.measure(0, 0);
        popWindowJuBao = new PopupWindow(window, window.getMeasuredWidth(), window.getMeasuredHeight(), true);
        popWindowJuBao.setBackgroundDrawable(getApplicationContext().getResources().getDrawable(R.drawable.pop_top));
        popWindowJuBao.setOutsideTouchable(true);

        Log.i("TAG", "showPopUpWindow: " + padding);
        //第一次显示控件的时候宽高会为0
        int deleteHeight = window.getHeight() == 0 ? 145 : window.getHeight();
        int deleteWidth = window.getWidth() == 0 ? 212 : window.getWidth();
        popWindowJuBao.showAsDropDown(view, (view.getWidth() - deleteWidth) / 2, -view.getHeight() - deleteHeight);
        window.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                popWindowJuBao.dismiss();
                reportCommentDialog();
                //  requestDeleteItem(adapter.getDataList().get(i).getId());
            }
        });
        popWindowJuBao.setOnDismissListener(new PopupWindow.OnDismissListener() {
            @Override
            public void onDismiss() {
                view.setBackgroundColor(getResources().getColor(R.color.white));
            }
        });
    }

    /*举报的列表---帖子的*/
    private Dialog respotCommentDialog;

    private void reportCommentDialog() {
        View view = getLayoutInflater().inflate(R.layout.comment_report_dialog,
                null);
        respotCommentDialog = new Dialog(this, R.style.transparentFrameWindowStyle);
        respotCommentDialog.setContentView(view, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT,
                ViewGroup.LayoutParams.WRAP_CONTENT));
        Window window = respotCommentDialog.getWindow();
        // 设置显示动画
        window.setWindowAnimations(R.style.main_menu_animstyle);
        WindowManager.LayoutParams wl = window.getAttributes();
        wl.x = 0;
        wl.y = getWindowManager().getDefaultDisplay().getHeight();
        // 以下这两句是为了保证按钮可以水平满屏
        wl.width = ViewGroup.LayoutParams.MATCH_PARENT;
        wl.height = ViewGroup.LayoutParams.WRAP_CONTENT;

        // 设置显示位置
        respotCommentDialog.onWindowAttributesChanged(wl);
        // 设置点击外围解散
        respotCommentDialog.setCanceledOnTouchOutside(true);
        respotCommentDialog.show();
    }

    /*广告垃圾的举报---评价的*/
    public void comment_advertising_grabage(View view) {
        InInvitationform(comment_uid, comment_id, 3 + "", 1 + "");
    }

    /*色情淫秽的举报--评价的*/
    public void comment_plagiarize(View view) {
        InInvitationform(comment_uid, comment_id, 3 + "", 2 + "");
    }

    /*恶意营销---评价的*/
    public void comment_hostility(View view) {
        InInvitationform(comment_uid, comment_id, 3 + "", 3 + "");
    }

    /*人身攻击---评价的*/
    public void comment_other(View view) {
        InInvitationform(comment_uid, comment_id, 3 + "", 4 + "");
    }

    /*取消----评价的*/
    public void comment_report_cancel(View view) {
        respotCommentDialog.cancel();
    }

    /**
     * 显示删除的弹框
     */
    private PopupWindow popWindow;

    private void showPopUpWindow(final View view, final int i) {
        TextView window = new TextView(activity);
        window.setText("删除");
        window.setTextColor(getResources().getColor(R.color.white));
        int padding = DensityUtil.dip2px(activity, 10);
        int bottom = DensityUtil.dip2px(activity, 15);
        window.setPadding(padding, padding, padding, bottom);
        window.measure(0, 0);
        popWindow = new PopupWindow(window, window.getMeasuredWidth(), window.getMeasuredHeight(), true);
        popWindow.setBackgroundDrawable(getApplicationContext().getResources().getDrawable(R.drawable.pop_top));
        popWindow.setOutsideTouchable(true);

        Log.i("TAG", "showPopUpWindow: " + padding);
        //第一次显示控件的时候宽高会为0
        int deleteHeight = window.getHeight() == 0 ? 145 : window.getHeight();
        int deleteWidth = window.getWidth() == 0 ? 212 : window.getWidth();
        popWindow.showAsDropDown(view, (view.getWidth() - deleteWidth) / 2, -view.getHeight() - deleteHeight);
        window.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                popWindow.dismiss();
                /*帖子的id*/
                List<NewAllAttentionBean.InfoBean.AllCommentBean> allComment = info.getAllComment();
                NewAllAttentionBean.InfoBean.AllCommentBean allCommentBean = allComment.get(i - 1);
                String id = allCommentBean.getId();
                deleteComment(id, i);
            }
        });
        popWindow.setOnDismissListener(new PopupWindow.OnDismissListener() {
            @Override
            public void onDismiss() {
                view.setBackgroundColor(getResources().getColor(R.color.white));
            }
        });
    }

    /*删除评价*/
    private void deleteComment(final String id, final int i) {
        DeleteCommentServer deleteCommentServer = ApiWrapper.getInstance().create(DeleteCommentServer.class);
        Call<DeleteCommentBean> deleteComment = deleteCommentServer.getDeleteComment(token, id);
        deleteComment.enqueue(new Callback<DeleteCommentBean>() {
            @Override
            public void onResponse(Call<DeleteCommentBean> call, Response<DeleteCommentBean> response) {
                DeleteCommentBean body = response.body();
                if (body != null) {
                    int code = body.getCode();
                    if (code == 1) {
                        MyToast.showToast(activity, "删除成功", Toast.LENGTH_SHORT);
                        attenttionDetailAdapter.getList().remove(i - 1);
                        attenttionDetailAdapter.notifyDataSetChanged();
                    } else if (code == 7200) {
                        MyToast.showToast(activity, "登陆后才可以删除", Toast.LENGTH_SHORT);
                    } else if (code == 7201) {
                        MyToast.showToast(activity, "该评价不存在", Toast.LENGTH_SHORT);
                    } else if (code == 7202) {
                        MyToast.showToast(activity, "已经删除过了", Toast.LENGTH_SHORT);
                    } else if (code == 7203) {
                        MyToast.showToast(activity, "您无权删除别人的评价", Toast.LENGTH_SHORT);
                    }
                } else {
                    MyToast.showToast(activity, "删除失败", Toast.LENGTH_SHORT);
                }
            }

            @Override
            public void onFailure(Call<DeleteCommentBean> call, Throwable t) {
                MyToast.showToast(context, "网络异常，请稍后重试", Toast.LENGTH_SHORT);
            }
        });
    }

    /*发消息前判断用户是否登录---是否加入书圈*/
    public void JudeWheTherItemMessage(final int i) {
        JudgeWhetherJoin judgeWhetherJoin = ApiWrapper.getInstance().create(JudgeWhetherJoin.class);
        Call<JudgeWhetherJoinBean> join = judgeWhetherJoin.getJoin(token, object_id);
        join.enqueue(new Callback<JudgeWhetherJoinBean>() {
            @Override
            public void onResponse(Call<JudgeWhetherJoinBean> call, Response<JudgeWhetherJoinBean> response) {
                JudgeWhetherJoinBean body = response.body();
                if (body != null) {
                    int code = body.getCode();
                    if (code == 1) {
                        ShowItemDiaolog();
                         /*延时弹起软键盘*/
                        ShowHideJianPan.showSoftKeyBorad(myItemEditText, 80);
                        PinLunHuiFuItem(i);
                    } else if (code == 0) {
                        //token 錯誤或則失效
                        showLoginDoalog();
                    } else if (code == 1600) {
                        //需要用户登陆后才可以操作
                        showLoginDoalog();
                    } else if (code == 1601) {
                        /*用户并没有加入该圈子*/
                        judgeJoinCircle();
                    } else if (code == 1602) {
                        //用户自己的帖子
                        MyToast.showToast(activity, "不能给自己评论", Toast.LENGTH_SHORT);
                    }
                }
            }

            @Override
            public void onFailure(Call<JudgeWhetherJoinBean> call, Throwable t) {
                MyToast.showToast(activity, "网络异常，请稍后重试", Toast.LENGTH_SHORT);
            }
        });
    }

    /*评论回复*/
    private void ShowItemDiaolog() {
        View view = getLayoutInflater().inflate(R.layout.my_item_edittext_dialog,
                null);
        myItemEditText = (EditText) view.findViewById(R.id.et_myitem_invitation);
        myItemTextView = (TextView) view.findViewById(R.id.tv_my_invitation);
        myEditTextDialog = new Dialog(this, R.style.transparentFrameWindowStyle);
        myEditTextDialog.setContentView(view, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT,
                ViewGroup.LayoutParams.WRAP_CONTENT));
          /*监听edittext内容发生变化是的操作*/
        myItemEditText.addTextChangedListener(new MyItemEditTextChangeListener());
        myItemTextView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                HuifuPinglun();
            }
        });
        Window window = myEditTextDialog.getWindow();
        /*设置去掉dialog四周的边距*/
        window.getDecorView().setPadding(0, 0, 0, 0);
        WindowManager.LayoutParams wl = window.getAttributes();
        wl.x = 0;
        wl.y = getWindowManager().getDefaultDisplay().getHeight();
        // 以下这两句是为了保证按钮可以水平满屏
        wl.width = ViewGroup.LayoutParams.MATCH_PARENT;
        wl.height = ViewGroup.LayoutParams.WRAP_CONTENT;
        /*解决软键盘把dialog盖住的问题*/
        myEditTextDialog.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);
        myEditTextDialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE |
                WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);
        // 设置显示位置
        myEditTextDialog.onWindowAttributesChanged(wl);
        // 设置点击外围解散
        myEditTextDialog.setCanceledOnTouchOutside(true);
        myEditTextDialog.show();
    }

    /*点击回复条目时候的发表*/
    private String pid = 0 + "";

    private void HuifuPinglun() {
        String trim = myItemEditText.getText().toString().trim();
        String pinglunContent = DeleteHtml.HtmlText.Html2Text(trim);
        if (pinglunContent.equals("")) {
            MyToast.showToast(activity, "请输入内容", Toast.LENGTH_SHORT);
        } else {
            PostCommentServer postCommentServer = ApiWrapper.getInstance().create(PostCommentServer.class);
            Call<PostCommentBean> postComment = postCommentServer.getPostComment(token, uid, uidHuiFuItem, id, object_id, pinglunContent, pidId);
            postComment.enqueue(new Callback<PostCommentBean>() {
                @Override
                public void onResponse(Call<PostCommentBean> call, Response<PostCommentBean> response) {
                    PostCommentBean body = response.body();
                    int code = body.getCode();
                    if (code == 1) {
                        MyToast.showToast(MyAttentionActivity.this, "评论成功", Toast.LENGTH_SHORT);
                        requesData();
                        myEditTextDialog.cancel();
                    } else if (code == 2700) {
                        MyToast.showToast(MyAttentionActivity.this, "需要登陆后才可以操作", Toast.LENGTH_SHORT);
                    } else if (code == 2701) {
                        MyToast.showToast(MyAttentionActivity.this, "抱歉您的账户被暂时限制了，无法进行此操作", Toast.LENGTH_SHORT);
                    } else if (code == 2702) {
                        MyToast.showToast(MyAttentionActivity.this, "该帖子不存在或者被冻结！", Toast.LENGTH_SHORT);
                    }
                }

                @Override
                public void onFailure(Call<PostCommentBean> call, Throwable t) {
                    MyToast.showToast(MyAttentionActivity.this, "网络异常，请稍后重试", Toast.LENGTH_SHORT);
                }
            });
        }
    }

    /*点击条目时获取的评论回复*/
    private void PinLunHuiFuItem(int i) {
        imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
        imm.showSoftInput(etInvitation, InputMethodManager.SHOW_FORCED);
        /*回复被回复人的id*/
        uidHuiFuItem = info.getAllComment().get(i - 1).getUid();
        /*当前回复帖子人的昵称*/
        String comment_name = info.getAllComment().get(i - 1).getComment_name();
        /*回复的id*/
        pidId = info.getAllComment().get(i - 1).getId();
        myItemEditText.setHint(Html.fromHtml("回复@" + "<font color= '#576b95'>" + comment_name + "</font>" + ":"));
    }

    private class MyItemEditTextChangeListener implements TextWatcher {
        /*内容发生变化时*/
        @Override
        public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
            myItemTextView.setText("发表");
            myItemTextView.setTextSize(18);
            //myItemTextView.setPadding(20, 0, 20, 4);
            //   myItemTextView.setBackgroundResource(R.drawable.invitation_publishs_shape);
        }

        /*
        *编辑框的内容正在发生改变时的回调方法 >>用户正在输入
        * 我们可以在这里实时地 通过搜索匹配用户的输入
        * */
        @Override
        public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
            CharSequence text = myItemEditText.getText();
            if (text instanceof Spannable) {
                Spannable spanText = (Spannable) text;
                Selection.setSelection(spanText, text.length());
                if (charSequence.length() == 0) {
                    myItemTextView.setText("发表");
                    // myItemTextView.setBackgroundResource(R.drawable.invitation_publish_shape);
                    myItemTextView.setTextColor(getResources().getColor(R.color.create_circle_type));
                } else {
                    myItemTextView.setText("发表");
                    //  myItemTextView.setBackgroundResource(R.color.red);
                    myItemTextView.setTextColor(getResources().getColor(R.color.red));

                }
            }

        }

        /*
        * 编辑框的内容改变以后,用户没有继续输入时 的回调方法
        * */
        @Override
        public void afterTextChanged(Editable editable) {
        }
    }

    /* 请求网络*/
    private int page = 1;
    private String token;
    /*头布局内容的图片的集合*/
    private List<String> imagesAll = new ArrayList<>();
    /*头布局打赏人的头像*/
    private List<NewAllAttentionBean.InfoBean.GiveInfoBean> give_pathAll = new ArrayList<>();
    /*评论内容的集合*/
    private List<NewAllAttentionBean.InfoBean.AllCommentBean> forumLzlReplyAll = new ArrayList<>();
    /*点赞人数的集合*/
    private List<NewAllAttentionBean.InfoBean.ForumBookmarkBean> forumBookmarkAll = new ArrayList<>();

    public void requesData() {
        Home_AllAtten_Server home_allAtten_server = ApiWrapper.getInstance().create(Home_AllAtten_Server.class);
        Call<NewAllAttentionBean> attentionDeatil = home_allAtten_server.getAttentionDeatil(token, allattentionid, page);
        attentionDeatil.enqueue(new Callback<NewAllAttentionBean>() {
            @Override
            public void onResponse(Call<NewAllAttentionBean> call, Response<NewAllAttentionBean> response) {
                NewAllAttentionBean body = response.body();
                if (body != null) {
                    int code = body.getCode();
                    if (code == 1) {
                        info = body.getInfo();
                        if (info != null) {
                            /*判断时候对该帖子点过赞*/
                            int is_bookmark = info.getIs_bookmark();
                            //1代表点赞了，0代表没有点赞
                            if (is_bookmark == 0) {
                                invitationZan.setImageResource(R.drawable.home_zan_item);
                            } else if (is_bookmark == 1) {
                                invitationZan.setImageResource(R.drawable.invitation_selected);
                            }
                            /*帖子的id*/
                            id = info.getId();
                            /*发帖人的id*/
                            uid = info.getUid();
                            /*当前登录用户的uid*/
                            user_uid = body.getUser_uid();
                            /*圈子的id*/
                            object_id = info.getObject_id();
                            images = info.getImages();
                            give_path = info.getGive_info();
                            NewAllAttentionBean.InfoBean info1 = body.getInfo();
                            forumLzlReply1 = info1.getAllComment();
                            forumBookmark = MyAttentionActivity.this.info.getForumBookmark();
                            /*帖子的点赞数量*/
                            zanCount = MyAttentionActivity.this.info.getSupport_num();
                            /*帖子的评论数量*/
                            reply_num = MyAttentionActivity.this.info.getReply_num();
                            if (!isLoading) {
                                imagesAll.clear();
                                give_pathAll.clear();
                                forumLzlReplyAll.clear();
                                attenttionDetailAdapter.clear();
                                forumBookmarkAll.clear();
                                zanCount1.clear();
                            }
                            if (images != null) {
                                imagesAll.addAll(images);
                            /*内容图片的集合*/
                                attention_headview_content_gridview.addAll(imagesAll);
                            }
                            if (give_path.size() != 0) {
                                give_pathAll.addAll(give_path);
                                /*给打赏头像的imageview填充布局*/
                                fillPlayHeadView();
                            } else {
                                invitationPlaytour.setVisibility(View.GONE);
                                playtour.setVisibility(View.GONE);
                                lPlaytour.setVisibility(View.GONE);
                            }
                            fillPlaytourView();
                            attentionPlaytourCountAdapter.addPlaytourAll(path);
                            fillHeadViewData();
                            if (forumLzlReply1 != null) {
                                forumLzlReplyAll.addAll(forumLzlReply1);
                                attenttionDetailAdapter.updateRes(forumLzlReplyAll, token, object_id, uid, id, user_uid);
                            }
                            /*点赞人数的集合*/
                            forumBookmarkAll.addAll(forumBookmark);


                        }
                    } else if (code == 0) {
                        showLoginDoalog();
                    }
                }
            }

            @Override
            public void onFailure(Call<NewAllAttentionBean> call, Throwable t) {
                MyToast.showToast(activity, "网络异常，请刷新重试", Toast.LENGTH_SHORT);
            }
        });
    }

    public void requesDataTie() {
        Home_AllAtten_Server home_allAtten_server = ApiWrapper.getInstance().create(Home_AllAtten_Server.class);
        Call<NewAllAttentionBean> attentionDeatil = home_allAtten_server.getAttentionDeatil(token, allattentionid, page);
        attentionDeatil.enqueue(new Callback<NewAllAttentionBean>() {
            @Override
            public void onResponse(Call<NewAllAttentionBean> call, Response<NewAllAttentionBean> response) {
                NewAllAttentionBean body = response.body();
                if (body != null) {
                    int code = body.getCode();
                    if (code == 1) {
                        info = body.getInfo();
                        if (info != null) {
                            /*判断时候对该帖子点过赞*/
                            int is_bookmark = info.getIs_bookmark();
                            //1代表点赞了，0代表没有点赞
                            if (is_bookmark == 0) {
                                invitationZan.setImageResource(R.drawable.home_zan_item);
                            } else if (is_bookmark == 1) {
                                invitationZan.setImageResource(R.drawable.invitation_selected);
                            }
                            /*帖子的id*/
                            id = info.getId();
                            /*发帖人的id*/
                            uid = info.getUid();
                            /*当前登录用户的uid*/
                            user_uid = body.getUser_uid();
                            /*圈子的id*/
                            object_id = info.getObject_id();
                            images = info.getImages();
                            give_path = info.getGive_info();
                            NewAllAttentionBean.InfoBean info1 = body.getInfo();
                            forumLzlReply1 = info1.getAllComment();
                            forumBookmark = MyAttentionActivity.this.info.getForumBookmark();
                            /*帖子的点赞数量*/
                            zanCount = MyAttentionActivity.this.info.getSupport_num();
                            /*帖子的评论数量*/
                            reply_num = MyAttentionActivity.this.info.getReply_num();
                                 /*点赞人数的集合*/
                            forumBookmarkAll.addAll(forumBookmark);
                            if (!isLoading) {
                                imagesAll.clear();
                                give_pathAll.clear();
                                forumLzlReplyAll.clear();
                                attenttionDetailAdapter.clear();
                                forumBookmarkAll.clear();
                                zanCount1.clear();
                            }
                            if (images != null) {
                                imagesAll.addAll(images);
                            /*内容图片的集合*/
                                attention_headview_content_gridview.addAll(imagesAll);
                            }
                            if (give_path.size() != 0) {
                                give_pathAll.addAll(give_path);
                                /*给打赏头像的imageview填充布局*/
                                fillPlayHeadView();
                            } else {
                                invitationPlaytour.setVisibility(View.GONE);
                                playtour.setVisibility(View.GONE);
                                lPlaytour.setVisibility(View.GONE);
                            }
                            fillPlaytourView();
                            attentionPlaytourCountAdapter.addPlaytourAll(path);

                            fillHeadViewData();
                            if (forumLzlReply1 != null) {
                                forumLzlReplyAll.addAll(forumLzlReply1);
                                attenttionDetailAdapter.updateRes(forumLzlReplyAll, token, object_id, uid, id, user_uid);
                                listView.setSelection(listView.getAdapter().getCount() - 1);
                            }


                        }
                    } else if (code == 0) {
                        showLoginDoalog();
                    }
                }
            }

            @Override
            public void onFailure(Call<NewAllAttentionBean> call, Throwable t) {
                MyToast.showToast(activity, "网络异常，请刷新重试", Toast.LENGTH_SHORT);
            }
        });
    }

    /*填充打赏头像的布局*/
    private void fillPlayHeadView() {
        int size = give_pathAll.size();
        if (size == 1) {
            imageYi.setVisibility(View.VISIBLE);
            imageEr.setVisibility(View.GONE);
            imageSan.setVisibility(View.GONE);
            imageSi.setVisibility(View.GONE);
            imageWu.setVisibility(View.GONE);
            imageLiu.setVisibility(View.GONE);
            imageQi.setVisibility(View.GONE);
            Glide.with(activity)
                    .load(Uri.parse(give_pathAll.get(0).getIcon_path()))
                    .error(R.drawable.login_logo)
                    .into(imageYi);
        } else if (size == 2) {
            imageYi.setVisibility(View.VISIBLE);
            imageEr.setVisibility(View.VISIBLE);
            imageSan.setVisibility(View.GONE);
            imageSi.setVisibility(View.GONE);
            imageWu.setVisibility(View.GONE);
            imageLiu.setVisibility(View.GONE);
            imageQi.setVisibility(View.GONE);
            Glide.with(activity)
                    .load(Uri.parse(give_pathAll.get(0).getIcon_path()))
                    .error(R.drawable.login_logo)
                    .into(imageYi);
            Glide.with(activity)
                    .load(Uri.parse(give_pathAll.get(1).getIcon_path()))
                    .error(R.drawable.login_logo)
                    .into(imageEr);
        } else if (size == 3) {
            imageYi.setVisibility(View.VISIBLE);
            imageEr.setVisibility(View.VISIBLE);
            imageSan.setVisibility(View.VISIBLE);
            imageSi.setVisibility(View.GONE);
            imageWu.setVisibility(View.GONE);
            imageLiu.setVisibility(View.GONE);
            imageQi.setVisibility(View.GONE);
            Glide.with(activity)
                    .load(Uri.parse(give_pathAll.get(0).getIcon_path()))
                    .error(R.drawable.login_logo)
                    .into(imageYi);
            Glide.with(activity)
                    .load(Uri.parse(give_pathAll.get(1).getIcon_path()))
                    .error(R.drawable.login_logo)
                    .into(imageEr);
            Glide.with(activity)
                    .load(Uri.parse(give_pathAll.get(2).getIcon_path()))
                    .error(R.drawable.login_logo)
                    .into(imageSan);
        } else if (size == 4) {
            imageYi.setVisibility(View.VISIBLE);
            imageEr.setVisibility(View.VISIBLE);
            imageSan.setVisibility(View.VISIBLE);
            imageSi.setVisibility(View.VISIBLE);
            imageWu.setVisibility(View.GONE);
            imageLiu.setVisibility(View.GONE);
            imageQi.setVisibility(View.GONE);
            Glide.with(activity)
                    .load(Uri.parse(give_pathAll.get(0).getIcon_path()))
                    .error(R.drawable.login_logo)
                    .into(imageYi);
            Glide.with(activity)
                    .load(Uri.parse(give_pathAll.get(1).getIcon_path()))
                    .error(R.drawable.login_logo)
                    .into(imageEr);
            Glide.with(activity)
                    .load(Uri.parse(give_pathAll.get(2).getIcon_path()))
                    .error(R.drawable.login_logo)
                    .into(imageSan);
            Glide.with(activity)
                    .load(Uri.parse(give_pathAll.get(3).getIcon_path()))
                    .error(R.drawable.login_logo)
                    .into(imageSi);
        } else if (size == 5) {
            imageYi.setVisibility(View.VISIBLE);
            imageEr.setVisibility(View.VISIBLE);
            imageSan.setVisibility(View.VISIBLE);
            imageSi.setVisibility(View.VISIBLE);
            imageWu.setVisibility(View.VISIBLE);
            imageLiu.setVisibility(View.GONE);
            imageQi.setVisibility(View.GONE);
            Glide.with(activity)
                    .load(Uri.parse(give_pathAll.get(0).getIcon_path()))
                    .error(R.drawable.login_logo)
                    .into(imageYi);
            Glide.with(activity)
                    .load(Uri.parse(give_pathAll.get(1).getIcon_path()))
                    .error(R.drawable.login_logo)
                    .into(imageEr);
            Glide.with(activity)
                    .load(Uri.parse(give_pathAll.get(2).getIcon_path()))
                    .error(R.drawable.login_logo)
                    .into(imageSan);
            Glide.with(activity)
                    .load(Uri.parse(give_pathAll.get(3).getIcon_path()))
                    .error(R.drawable.login_logo)
                    .into(imageSi);
            Glide.with(activity)
                    .load(Uri.parse(give_pathAll.get(4).getIcon_path()))
                    .error(R.drawable.login_logo)
                    .into(imageWu);
        } else if (size == 6) {
            imageYi.setVisibility(View.VISIBLE);
            imageEr.setVisibility(View.VISIBLE);
            imageSan.setVisibility(View.VISIBLE);
            imageSi.setVisibility(View.VISIBLE);
            imageWu.setVisibility(View.VISIBLE);
            imageLiu.setVisibility(View.VISIBLE);
            imageQi.setVisibility(View.GONE);
            Glide.with(activity)
                    .load(Uri.parse(give_pathAll.get(0).getIcon_path()))
                    .error(R.drawable.login_logo)
                    .into(imageYi);
            Glide.with(activity)
                    .load(Uri.parse(give_pathAll.get(1).getIcon_path()))
                    .error(R.drawable.login_logo)
                    .into(imageEr);
            Glide.with(activity)
                    .load(Uri.parse(give_pathAll.get(2).getIcon_path()))
                    .error(R.drawable.login_logo)
                    .into(imageSan);
            Glide.with(activity)
                    .load(Uri.parse(give_pathAll.get(3).getIcon_path()))
                    .error(R.drawable.login_logo)
                    .into(imageSi);
            Glide.with(activity)
                    .load(Uri.parse(give_pathAll.get(4).getIcon_path()))
                    .error(R.drawable.login_logo)
                    .into(imageWu);
            Glide.with(activity)
                    .load(Uri.parse(give_pathAll.get(5).getIcon_path()))
                    .error(R.drawable.login_logo)
                    .into(imageLiu);
        } else if (size == 7) {
            imageYi.setVisibility(View.VISIBLE);
            imageEr.setVisibility(View.VISIBLE);
            imageSan.setVisibility(View.VISIBLE);
            imageSi.setVisibility(View.VISIBLE);
            imageWu.setVisibility(View.VISIBLE);
            imageLiu.setVisibility(View.VISIBLE);
            imageQi.setVisibility(View.VISIBLE);
            Glide.with(activity)
                    .load(Uri.parse(give_pathAll.get(0).getIcon_path()))
                    .error(R.drawable.login_logo)
                    .into(imageYi);
            Glide.with(activity)
                    .load(Uri.parse(give_pathAll.get(1).getIcon_path()))
                    .error(R.drawable.login_logo)
                    .into(imageEr);
            Glide.with(activity)
                    .load(Uri.parse(give_pathAll.get(2).getIcon_path()))
                    .error(R.drawable.login_logo)
                    .into(imageSan);
            Glide.with(activity)
                    .load(Uri.parse(give_pathAll.get(3).getIcon_path()))
                    .error(R.drawable.login_logo)
                    .into(imageSi);
            Glide.with(activity)
                    .load(Uri.parse(give_pathAll.get(4).getIcon_path()))
                    .error(R.drawable.login_logo)
                    .into(imageWu);
            Glide.with(activity)
                    .load(Uri.parse(give_pathAll.get(5).getIcon_path()))
                    .error(R.drawable.login_logo)
                    .into(imageLiu);
            Glide.with(activity)
                    .load(Uri.parse(give_pathAll.get(6).getIcon_path()))
                    .error(R.drawable.login_logo)
                    .into(imageLiu);
        }
    }

/*给二级评论发送数据---在AttentinonDetailAdapter中调用了*/
 /*   public void getInvitationData() {

    }*/

    /*token错误或失效*/
    AlertDialog ad;
    private TextView quxiao;
    private TextView queding;

    private void showLoginDoalog() {

        ad = new AlertDialog.Builder(activity).create();
        ad.show();
        Window window = ad.getWindow();
        window.setContentView(R.layout.dailog_login);
        quxiao = (TextView) window.findViewById(R.id.dialog_login_quxiao);
        queding = (TextView) window.findViewById(R.id.dialog_login_queding);
        quxiao.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                ad.dismiss();
            }
        });
        queding.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
//                AbSharedUtil.putString(context, SharedConstants.USER_TOKEN, "");
                intent.setClass(activity, LoginActivity.class);
                startActivity(intent);
                ad.dismiss();
            }
        });
    }

    /*
    * 初始化根布局的控件
    * */
    private void initView() {
        intent = new Intent();
        getIntent = getIntent();
        token = AbSharedUtil.getString(activity, SharedConstants.USER_TOKEN);
        allattentionid = getIntent().getStringExtra("allattentionid");
        allattentiontitle = getIntent().getStringExtra("allattentiontitle");
        allattentionnickname = getIntent().getStringExtra("allattentionnickname");
        invitationFromContent.setText(allattentiontitle);
        invitationFromContent.setOnClickListener(this);
        invitationLeft.setOnClickListener(this);
        tvInvitationDialog.setOnClickListener(this);
        llFrom.setOnClickListener(this);
        invitationFromContent.setOnClickListener(this);

    }

    private class MyEditTextChangeListener implements TextWatcher {
        /*内容发生变化时*/
        @Override
        public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
            tvInvitation.setText("发表");
            tvInvitation.setTextSize(18);
            // tvInvitation.setPadding(20, 0, 8, 12);
            //  tvInvitation.setBackgroundResource(R.drawable.invitation_publishs_shape);
        }

        /*
        *编辑框的内容正在发生改变时的回调方法 >>用户正在输入
        * 我们可以在这里实时地 通过搜索匹配用户的输入
        * */
        @Override
        public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
            CharSequence text = etInvitation.getText();
            if (text instanceof Spannable) {
                Spannable spanText = (Spannable) text;
                Selection.setSelection(spanText, text.length());
                if (charSequence.length() == 0) {
                    tvInvitation.setText("发表");
                    //  tvInvitation.setPadding(20, 0, 8, 12);
                    // tvInvitation.setBackgroundResource(R.drawable.invitation_publish_shape);
                    tvInvitation.setTextColor(getResources().getColor(R.color.create_circle_type));
                } else {
                    tvInvitation.setText("发表");
                    // tvInvitation.setPadding(20, 0, 8, 12);
                    tvInvitation.setTextColor(getResources().getColor(R.color.black));
                    //tvInvitation.setBackgroundResource(R.color.red);

                }
            }

        }

        /*
        * 编辑框的内容改变以后,用户没有继续输入时 的回调方法
        * */
        @Override
        public void afterTextChanged(Editable editable) {
        }
    }

    @Override
    public void onClick(View view) {
        switch (view.getId()) {
            /*
            * 返回
            * */
            case R.id.invitation_left:
                finish();
                break;
            /*来自*/
            case R.id.invitation_from_content:
                /*跳转到圈子的详情页*/
                JudgeWheTherJoin();
                //showFromDialog();
                break;
            /*头布局中向下的箭头*/
            case R.id.invitation_down:
                JudgeWherInvitation();
                break;
            /*头布局中的分享*/
            case R.id.invitation_share:
                showShare();
                break;
             /*
            * 打赏
            * */
            case R.id.invitation_playtour:
                PlayTour();
                break;
             /*
            * 点赞
            * */
            case R.id.invitation_zan:
                JudeWheTherZan();
                break;
            /*消息*/
            case R.id.invitation_message:
                JudeWheTherMessage();
                break;
            /*弹出编辑的输入框*/
            case R.id.tv_invitation_dialog:
                JudeWheTherMessage();
                break;
        }
    }

    /*点发消息---或者默认的时候 -- 显示编辑输入框的diaolog*/
    private void showEditTextDialog() {
        View view = getLayoutInflater().inflate(R.layout.my_edittext_dialog,
                null);
        etInvitation = (EditText) view.findViewById(R.id.et_invitation);
        tvInvitation = (TextView) view.findViewById(R.id.tv_invitation);
        myEditTextDialog = new Dialog(this, R.style.transparentFrameWindowStyle);
        myEditTextDialog.setContentView(view, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT,
                ViewGroup.LayoutParams.WRAP_CONTENT));
          /*监听edittext内容发生变化是的操作*/
        etInvitation.addTextChangedListener(new MyEditTextChangeListener());
        /*监听edittext获取失去焦点时的操作*/
        etInvitation.setOnFocusChangeListener(new View.OnFocusChangeListener() {
            @Override
            public void onFocusChange(View view, boolean b) {
                /*此处为得到焦点时的操作*/
                if (b) {
                    // JudeWheTherMessage();
                } else {
                    imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
                    //此处为失去焦点时的区别
                    etInvitation.setHint("");
                }
            }
        });
        tvInvitation.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                publicData();
            }
        });
        Window window = myEditTextDialog.getWindow();
        /*设置去掉dialog四周的边距*/
        window.getDecorView().setPadding(0, 0, 0, 0);
        // 设置显示动画
        //   window.setWindowAnimations(R.style.main_menu_animstyle);
        WindowManager.LayoutParams wl = window.getAttributes();
        wl.x = 0;
        wl.y = getWindowManager().getDefaultDisplay().getHeight();
        // 以下这两句是为了保证按钮可以水平满屏
        wl.width = ViewGroup.LayoutParams.MATCH_PARENT;
        wl.height = ViewGroup.LayoutParams.WRAP_CONTENT;
        /*解决软键盘把dialog盖住的问题*/
        myEditTextDialog.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);
        myEditTextDialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE |
                WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);
        // 设置显示位置
        myEditTextDialog.onWindowAttributesChanged(wl);
        // 设置点击外围解散
        myEditTextDialog.setCanceledOnTouchOutside(true);
        myEditTextDialog.show();
    }


    /*发表的接口*/
    private void publicData() {
        String trim = etInvitation.getText().toString().trim();
        String pinglunContent = DeleteHtml.HtmlText.Html2Text(trim);
        if (pinglunContent.equals("")) {
            MyToast.showToast(activity, "请输入内容", Toast.LENGTH_SHORT);
        } else {
            PostCommentServer postCommentServer = ApiWrapper.getInstance().create(PostCommentServer.class);
            Call<PostCommentBean> postComment = postCommentServer.getPostComment(token, uidHuiFuItem, uidHuiFuItem, idHuiFuItem, object_id, pinglunContent, pid);
            postComment.enqueue(new Callback<PostCommentBean>() {
                @Override
                public void onResponse(Call<PostCommentBean> call, Response<PostCommentBean> response) {
                    PostCommentBean body = response.body();
                    int code = body.getCode();
                    if (code == 1) {
                        MyToast.showToast(MyAttentionActivity.this, "评论成功", Toast.LENGTH_SHORT);
                        // attenttionDetailAdapter.notifyDataSetChanged();
                        isLoading = false;
                        requesDataTie();
                        myEditTextDialog.cancel();

                    } else if (code == 2700) {
                        MyToast.showToast(MyAttentionActivity.this, "需要登陆后才可以操作", Toast.LENGTH_SHORT);
                    } else if (code == 2701) {
                        MyToast.showToast(MyAttentionActivity.this, "抱歉您的账户被暂时限制了，无法进行此操作", Toast.LENGTH_SHORT);
                    } else if (code == 2702) {
                        MyToast.showToast(MyAttentionActivity.this, "该帖子不存在或者被冻结！", Toast.LENGTH_SHORT);
                    }

                }

                @Override
                public void onFailure(Call<PostCommentBean> call, Throwable t) {
                    MyToast.showToast(MyAttentionActivity.this, "网络异常，请稍后重试", Toast.LENGTH_SHORT);
                }
            });
        }
    }

    /*发消息前判断用户是否登录---是否加入书圈*/
    private void JudeWheTherMessage() {
        JudgeWhetherJoin judgeWhetherJoin = ApiWrapper.getInstance().create(JudgeWhetherJoin.class);
        Call<JudgeWhetherJoinBean> join = judgeWhetherJoin.getJoin(token, object_id);
        join.enqueue(new Callback<JudgeWhetherJoinBean>() {
            @Override
            public void onResponse(Call<JudgeWhetherJoinBean> call, Response<JudgeWhetherJoinBean> response) {
                JudgeWhetherJoinBean body = response.body();
                if (body != null) {
                    int code = body.getCode();
                    if (code == 1) {
                        showEditTextDialog();
                        ShowHideJianPan.showSoftKeyBorad(etInvitation, 200);
                        pingLunHuifu();
                    } else if (code == 0) {
                        //token 錯誤或則失效
                        showLoginDoalog();
                    } else if (code == 1600) {
                        //需要用户登陆后才可以操作
                        showLoginDoalog();
                    } else if (code == 1601) {
                        /*用户并没有加入该圈子*/
                        judgeJoinCircle();
                    } else if (code == 1602) {
                        //用户自己的帖子
                        MyToast.showToast(activity, "不能给自己评论", Toast.LENGTH_SHORT);
                    }
                }
            }

            @Override
            public void onFailure(Call<JudgeWhetherJoinBean> call, Throwable t) {
                MyToast.showToast(activity, "网络异常，请稍后重试", Toast.LENGTH_SHORT);
            }
        });
    }

    /*评论回复*/
    private void pingLunHuifu() {
//        InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
//        imm.toggleSoftInput(0, InputMethodManager.HIDE_NOT_ALWAYS);
        imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
        imm.showSoftInput(etInvitation, InputMethodManager.SHOW_FORCED);
        /*帖子的id*/
        idHuiFuItem = info.getId();
                    /*发帖人的id*/
        uidHuiFuItem = info.getUid();
        /*被回复对象的id*/
        idHuiFuItem1 = uidHuiFuItem;
                    /*圈子的id*/
        object_id = info.getObject_id();
                    /*当前发帖人的昵称*/
        String nickname1 = info.getMember().getNickname();
        etInvitation.setHint(Html.fromHtml("评论@" + "<font color= '#576b95'>" + nickname1 + "</font>" + ":"));
    }

    /*判断是否可以点赞*/
    private void JudeWheTherZan() {
        JudgeWhetherJoin judgeWhetherJoin = ApiWrapper.getInstance().create(JudgeWhetherJoin.class);
        Call<JudgeWhetherJoinBean> join = judgeWhetherJoin.getJoin(token, object_id);
        join.enqueue(new Callback<JudgeWhetherJoinBean>() {
            @Override
            public void onResponse(Call<JudgeWhetherJoinBean> call, Response<JudgeWhetherJoinBean> response) {
                JudgeWhetherJoinBean body = response.body();
                if (body != null) {
                    int code = body.getCode();
                    if (code == 1) {
                        dianZan();
                    } else if (code == 0) {
                        //token 錯誤或則失效
                        showLoginDoalog();
                    } else if (code == 1600) {
                        //需要用户登陆后才可以操作
                        showLoginDoalog();
                    } else if (code == 1601) {
                        /*用户并没有加入该圈子*/
                        judgeJoinCircle();
                    }
                }
            }

            @Override
            public void onFailure(Call<JudgeWhetherJoinBean> call, Throwable t) {
                MyToast.showToast(activity, "网络异常，请稍后重试", Toast.LENGTH_SHORT);
            }
        });
    }

    /*点赞*/
    private void dianZan() {
    /*别人的帖子*/
        final String nickname = AbSharedUtil.getString(activity, SharedConstants.USER_NICKNAME);
        int i = Integer.parseInt(id);
        int type = 1;
        Retrofit retrofit = new Retrofit.Builder()
                .baseUrl("http://www.iwenyu.cn/forum/index/dobookmark.html/")
                .addConverterFactory(GsonConverterFactory.create())
                .build();
        Homepage_All_Server homepage_all_server1 = retrofit.create(Homepage_All_Server.class);
        Call<LikeBean> like1 = homepage_all_server1.getLike(token, i, 1);
        like1.enqueue(new Callback<LikeBean>() {
            @Override
            public void onResponse(Call<LikeBean> call, Response<LikeBean> response) {
                LikeBean body = response.body();
                if (body != null) {
                    int code = body.getCode();
                    if (code == 1) {
                        MyToast.showToast(activity, "点赞成功", Toast.LENGTH_SHORT);
                        invitationZan.setImageResource(R.drawable.home_zan_item);
                        zanCount1.clear();
                        zanCount1.add(0, nickname);
                        NewAllAttentionBean.InfoBean.ForumBookmarkBean bean = new NewAllAttentionBean.InfoBean.ForumBookmarkBean();
                        bean.setNickname(nickname);
                        bean.setUid(user_uid);
                        requesData();
                        // AlertLikeCount();
                        attenttionDetailAdapter.notifyDataSetChanged();

                    } else if (code == 0) {
                        MyToast.showToast(activity, "登陆失效，请重新登陆！", Toast.LENGTH_SHORT);
                    } else if (code == 2300) {
                        MyToast.showToast(activity, "需要登陆之后才可以操作", Toast.LENGTH_SHORT);
                    } else if (code == 2301) {
                        MyToast.showToast(activity, "抱歉您的账户被暂时限制了，无法进行此操作", Toast.LENGTH_SHORT);
                    } else if (code == 2303) {
                        MyToast.showToast(activity, "系统繁忙，请稍后再试", Toast.LENGTH_SHORT);
                    } else if (code == 2302) {
                        MyToast.showToast(activity, "您已经点过赞了!", Toast.LENGTH_SHORT);
                    } else if (code == 2304) {
                        MyToast.showToast(activity, "该帖子不存在或者被冻结", Toast.LENGTH_SHORT);
                    } else if (code == 2305) {
                        MyToast.showToast(activity, "该回复不存在或者已经被屏蔽", Toast.LENGTH_SHORT);
                    }
                }
            }

            @Override
            public void onFailure(Call<LikeBean> call, Throwable t) {
                MyToast.showToast(activity, "系统繁忙，请稍后再试", Toast.LENGTH_SHORT);
            }
        });
    }

    /*打赏*/
    private void PlayTour() {
        JudgeWhetherJoin judgeWhetherJoin = ApiWrapper.getInstance().create(JudgeWhetherJoin.class);
        Call<JudgeWhetherJoinBean> join = judgeWhetherJoin.getJoin(token, object_id);
        join.enqueue(new Callback<JudgeWhetherJoinBean>() {
            @Override
            public void onResponse(Call<JudgeWhetherJoinBean> call, Response<JudgeWhetherJoinBean> response) {
                JudgeWhetherJoinBean body = response.body();
                if (body != null) {
                    int code = body.getCode();
                    if (code == 1) {
                    /*别人的帖子*/
                        PlaytoueDialog();
                    } else if (code == 0) {
                        //token 錯誤或則失效
                        showLoginDoalog();
                    } else if (code == 1600) {
                        //需要用户登陆后才可以操作
                        showLoginDoalog();
                    } else if (code == 1601) {
                /*用户并没有加入该圈子*/
                        String circleId = info.getObject_id();
                        intent.setClass(activity, CircleFindDetailActivity.class);
                        intent.putExtra("circle_find_id", circleId);
                        startActivity(intent);
                    } else if (code == 1602) {
                        //用户自己的帖子
                        MyToast.showToast(activity, "不能给自己打赏", Toast.LENGTH_SHORT);
                    }
                }
            }

            @Override
            public void onFailure(Call<JudgeWhetherJoinBean> call, Throwable t) {
                MyToast.showToast(activity, "网络异常，请稍后重试", Toast.LENGTH_SHORT);
            }
        });
    }

    private Dialog playtourDialog;
    private static final int SHOW_MONEY = 0;
    private Handler handler = new Handler() {
        public void handleMessage(Message msg) {
            switch (msg.what) {
                case SHOW_MONEY:
                    showMoney();
                    break;
            }
        }
    };
    private double[] arr;
    private int money = 0;
    private TextView plautourMoney;

    /*显示钱数*/
    public void showMoney() {
        money++;
        int index = (int) (Math.random() * arr.length);
        double v = arr[index];
        plautourMoney.setText(v + "");
        handler.sendEmptyMessageDelayed(SHOW_MONEY, 300);
        if (money == 100) {
            handler.removeCallbacksAndMessages(null);
            money = 0;
        }
    }

    private CircleImageView playtourHead;

    /*随机打赏*/
    private void PlaytoueDialog() {
        View view = getLayoutInflater().inflate(R.layout.playtour_random_dialog,
                null);
        //1.0、1.23、2.0、2.22、2.68、3.0、3.88、5.20、6.66、6.88、8.88、8.66、9.99
        /*隨機打賞的錢數*/
        plautourMoney = (TextView) view.findViewById(R.id.tv_playtour_money);
        /*随机打赏对方的头像*/
        playtourHead = (CircleImageView) view.findViewById(R.id.playtour_head);
        Glide.with(MyAttentionActivity.this)
                .load(info.getAvatar().getPath())
                .error(R.drawable.login_logo)
                .into(playtourHead);
        /*对方的昵称*/
        nickName = (TextView) view.findViewById(R.id.tv_playtour_nickname);
        nickName.setText(info.getMember().getNickname());
        arr = new double[]{1.0, 1.23, 2.0, 2.22, 2.68, 3.0, 3.88, 5.20, 6.66, 6.88, 8.66, 9.99};
        for (int j = 1; j < arr.length; j++) {
            handler.sendEmptyMessage(SHOW_MONEY);
            System.out.println("InvitationDetailActivity: j" + j);
        }
        playtourDialog = new Dialog(this, R.style.transparentFrameWindowStyle);
        playtourDialog.setContentView(view, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT,
                ViewGroup.LayoutParams.WRAP_CONTENT));
        Window window = playtourDialog.getWindow();
        // 设置显示动画
        window.setWindowAnimations(R.style.main_menu_animstyle);
        WindowManager.LayoutParams wl = window.getAttributes();
        wl.x = 0;
        wl.y = getWindowManager().getDefaultDisplay().getHeight();
        // 以下这两句是为了保证按钮可以水平满屏
        wl.width = ViewGroup.LayoutParams.MATCH_PARENT;
        wl.height = ViewGroup.LayoutParams.WRAP_CONTENT;

        // 设置显示位置
        playtourDialog.onWindowAttributesChanged(wl);
        // 设置点击外围解散
        playtourDialog.setCanceledOnTouchOutside(true);
        playtourDialog.show();
    }

    /*随机打赏取消*/
    public void playtourCancles(View view) {
        playtourDialog.cancel();
        handler.removeCallbacksAndMessages(null);
    }

    /*随机打赏---调起微信*/
    private String WXMoney;

    public void tv_playtour(View view) {
        /*打赏的钱数*/
        String playtourMoney = plautourMoney.getText().toString().trim();
        WXMoney = playtourMoney;
        playtourData(WXMoney);
    }

    /*其他金额*/
    public void tv_playtour_else(View view) {
        costomMoneyDialog();
        playtourDialog.cancel();
    }

    /*自定义金额中的取消*/
    public void tv_costam_else(View view) {
        PlaytoueDialog();
        costomMoneyDialog.cancel();
    }

    /*自定义金额的dialog*/
    private Dialog costomMoneyDialog;

    private void costomMoneyDialog() {
        View view = getLayoutInflater().inflate(R.layout.constom_money_dialog,
                null);
        costomMoneyDialog = new Dialog(this, R.style.transparentFrameWindowStyle);
        /*打赏者的头像*/
        CircleImageView costomHeadView = (CircleImageView) view.findViewById(R.id.costam_head);
        Glide.with(activity)
                .load(info.getAvatar().getPath())
                .error(R.drawable.login_logo)
                .into(costomHeadView);
        /*打赏者的昵称*/
        TextView constamNickname = (TextView) view.findViewById(R.id.tv_costam_nickname);
        constamNickname.setText(info.getMember().getNickname());
        /*打赏者的钱数*/
        costomMoney = (EditText) view.findViewById(R.id.tv_costam_money);
        costomMoneyDialog.setContentView(view, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT,
                ViewGroup.LayoutParams.WRAP_CONTENT));
        Window window = costomMoneyDialog.getWindow();
        // 设置显示动画
        window.setWindowAnimations(R.style.main_menu_animstyle);
        WindowManager.LayoutParams wl = window.getAttributes();
        wl.x = 0;
        wl.y = getWindowManager().getDefaultDisplay().getHeight();
        // 以下这两句是为了保证按钮可以水平满屏
        wl.width = ViewGroup.LayoutParams.MATCH_PARENT;
        wl.height = ViewGroup.LayoutParams.WRAP_CONTENT;

        // 设置显示位置
        costomMoneyDialog.onWindowAttributesChanged(wl);
        // 设置点击外围解散
        costomMoneyDialog.setCanceledOnTouchOutside(true);
        costomMoneyDialog.show();
    }

    /*调起微信*/
    public void tv_costam(View view) {
        String costomWXMoney = costomMoney.getText().toString().trim();
        if (costomWXMoney.equals("")) {
            MyToast.showToast(activity, "请输入金额", Toast.LENGTH_SHORT);
        } else {
            double v = Double.parseDouble(costomWXMoney);
            if (v < 1) {
                MyToast.showToast(activity, "最低打赏金额1元", Toast.LENGTH_SHORT);
            } else if (v > 200) {
                MyToast.showToast(activity, "最高打赏金额200元", Toast.LENGTH_SHORT);
            } else {
                WXMoney = costomWXMoney;
            /*判断金额是否输入正确*/
                String regEx = "^[0-9]+(.[0-9]{1,2})?$";
                Pattern pattern = Pattern.compile(regEx);
                Matcher matcher = pattern.matcher(WXMoney);
                boolean b = matcher.matches();
                if (b) {
                    playtourData(WXMoney);
                } else {
                    MyToast.showToast(activity, "打赏金额保留两位小数", Toast.LENGTH_SHORT);
                }
            }
        }
    }

    /*自定义打赏*/
    public void playtourCancle(View view) {
        costomMoneyDialog.cancel();
    }

    /*头布局中向下箭头的点击事件*/
    private void JudgeWherInvitation() {
        JudgeWhetherJoin judgeWhetherJoin = ApiWrapper.getInstance().create(JudgeWhetherJoin.class);
        Call<JudgeWhetherJoinBean> join = judgeWhetherJoin.getJoin(token, object_id);
        join.enqueue(new Callback<JudgeWhetherJoinBean>() {
            @Override
            public void onResponse(Call<JudgeWhetherJoinBean> call, Response<JudgeWhetherJoinBean> response) {
                JudgeWhetherJoinBean body = response.body();
                if (body != null) {
                    int code = body.getCode();
                    if (code == 1) {
                        if (user_uid.equals(uid)) {
                            //用户自己的帖子
                            MyShowDownDialog();
                        } else {
                             /*别人的帖子*/
                            showDownDialog();
                        }
                    } else if (code == 0) {
                        //token 錯誤或則失效
                        showLoginDoalog();
                    } else if (code == 1600) {
                        //需要用户登陆后才可以操作
                        showLoginDoalog();
                    } else if (code == 1601) {
                        /*用户并没有加入该圈子*/
                        judgeJoinCircle();
                    }
                }
            }

            @Override
            public void onFailure(Call<JudgeWhetherJoinBean> call, Throwable t) {
                MyToast.showToast(activity, "网络异常，请稍后重试", Toast.LENGTH_SHORT);
            }
        });
    }

    /*显示向下的箭头---自己的帖子的dialog*/
    private Dialog MyDdownDialog;

    private void MyShowDownDialog() {
        View view = getLayoutInflater().inflate(R.layout.my_down_dialog,
                null);
        MyDdownDialog = new Dialog(this, R.style.transparentFrameWindowStyle);
        MyDdownDialog.setContentView(view, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT,
                ViewGroup.LayoutParams.WRAP_CONTENT));
        Window window = MyDdownDialog.getWindow();
        // 设置显示动画
        window.setWindowAnimations(R.style.main_menu_animstyle);
        WindowManager.LayoutParams wl = window.getAttributes();
        wl.x = 0;
        wl.y = getWindowManager().getDefaultDisplay().getHeight();
        // 以下这两句是为了保证按钮可以水平满屏
        wl.width = ViewGroup.LayoutParams.MATCH_PARENT;
        wl.height = ViewGroup.LayoutParams.WRAP_CONTENT;

        // 设置显示位置
        MyDdownDialog.onWindowAttributesChanged(wl);
        // 设置点击外围解散
        MyDdownDialog.setCanceledOnTouchOutside(true);
        MyDdownDialog.show();
    }

    /*取消*/
    public void myClick(View view) {
        MyDdownDialog.cancel();
    }

    /*收藏*/
    public void myCollect(View view) {
        collectInvitation();
    }

    /*分享*/
    public void myShare(View view) {
        showShare();
    }

    /*删除*/
    public void mydelete(View view) {
        postDeleteServer postDeleteServer = ApiWrapper.getInstance().create(postDeleteServer.class);
        Call<postDeleteBean> delete = postDeleteServer.getDelete(token, id, uid);
        delete.enqueue(new Callback<postDeleteBean>() {
            @Override
            public void onResponse(Call<postDeleteBean> call, Response<postDeleteBean> response) {
                postDeleteBean body = response.body();
                if (body != null) {
                    int code = body.getCode();
                    String msg = body.getMsg();
                    if (code == 1) {
                        MyToast.showToast(MyAttentionActivity.this, "删除成功", Toast.LENGTH_SHORT);
                        MyDdownDialog.cancel();
                        finish();
                    } else if (code == 0) {
                        showLoginDoalog();
                    } else if (code == 2800) {
                        MyToast.showToast(MyAttentionActivity.this, msg, Toast.LENGTH_SHORT);
                    } else if (code == 2801) {
                        MyToast.showToast(MyAttentionActivity.this, msg, Toast.LENGTH_SHORT);
                    } else if (code == 2802) {
                        MyToast.showToast(MyAttentionActivity.this, msg, Toast.LENGTH_SHORT);
                    } else if (code == 2803) {
                        MyToast.showToast(MyAttentionActivity.this, msg, Toast.LENGTH_SHORT);
                    } else if (code == 2804) {
                        MyToast.showToast(MyAttentionActivity.this, msg, Toast.LENGTH_SHORT);
                    }
                }
            }

            @Override
            public void onFailure(Call<postDeleteBean> call, Throwable t) {
                MyToast.showToast(activity, "网络异常，请稍后重试！", Toast.LENGTH_SHORT);
            }
        });

    }

    /*显示向下的箭头---他人的帖子的dialog*/
    private Dialog downDialog;

    private void showDownDialog() {
        View view = getLayoutInflater().inflate(R.layout.other_down_dialog,
                null);
        downDialog = new Dialog(this, R.style.transparentFrameWindowStyle);
        downDialog.setContentView(view, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT,
                ViewGroup.LayoutParams.WRAP_CONTENT));
        Window window = downDialog.getWindow();
        // 设置显示动画
        window.setWindowAnimations(R.style.main_menu_animstyle);
        WindowManager.LayoutParams wl = window.getAttributes();
        wl.x = 0;
        wl.y = getWindowManager().getDefaultDisplay().getHeight();
        // 以下这两句是为了保证按钮可以水平满屏
        wl.width = ViewGroup.LayoutParams.MATCH_PARENT;
        wl.height = ViewGroup.LayoutParams.WRAP_CONTENT;

        // 设置显示位置
        downDialog.onWindowAttributesChanged(wl);
        // 设置点击外围解散
        downDialog.setCanceledOnTouchOutside(true);
        downDialog.show();
    }

    /*取消*/
    public void on_click(View view) {
        downDialog.cancel();
    }

    /*收藏*/
    public void collect(View view) {
        collectInvitation();
    }

    /*收藏帖子---他人的帖子*/
    private void collectInvitation() {
        CollectInvitationServer collectInvitationServer = ApiWrapper.getInstance().create(CollectInvitationServer.class);
        Call<CollectInvitaionBean> collectBean = collectInvitationServer.getCollectBean(token, id, 2 + "", 1 + "");
        collectBean.enqueue(new Callback<CollectInvitaionBean>() {
            @Override
            public void onResponse(Call<CollectInvitaionBean> call, Response<CollectInvitaionBean> response) {
                CollectInvitaionBean body = response.body();
                if (body != null) {
                    int code = body.getCode();
                    String msg = body.getMsg();
                    if (code == 1) {
                        if (MyDdownDialog != null) {
                            MyDdownDialog.cancel();
                        }
                        if (downDialog != null) {
                            downDialog.cancel();
                        }
                        MyToast.showToast(MyAttentionActivity.this, "收藏成功", Toast.LENGTH_SHORT);
                    } else if (code == 0) {
                        showLoginDoalog();
                    } else if (code == 2500) {
                        MyToast.showToast(MyAttentionActivity.this, msg, Toast.LENGTH_SHORT);
                    } else if (code == 2502) {
                        MyToast.showToast(MyAttentionActivity.this, msg, Toast.LENGTH_SHORT);
                    } else if (code == 2505) {
                        MyToast.showToast(MyAttentionActivity.this, msg, Toast.LENGTH_SHORT);
                    } else if (code == 2506) {
                        MyToast.showToast(MyAttentionActivity.this, msg, Toast.LENGTH_SHORT);
                    } else if (code == 2507) {
                        MyToast.showToast(MyAttentionActivity.this, msg, Toast.LENGTH_SHORT);
                    } else if (code == 2508) {
                        MyToast.showToast(MyAttentionActivity.this, msg, Toast.LENGTH_SHORT);
                    }
                }
            }

            @Override
            public void onFailure(Call<CollectInvitaionBean> call, Throwable t) {
                MyToast.showToast(MyAttentionActivity.this, "系统繁忙，请稍后重试！", Toast.LENGTH_SHORT);
            }
        });
    }

    /*分享*/
    public void otherShare(View view) {
        showShare();
    }

    /*举报*/
    public void report(View view) {
        reportInvitaionDialog();
    }

    /*举报的列表---帖子的*/
    private Dialog respotInvitationDialog;

    private void reportInvitaionDialog() {
        View view = getLayoutInflater().inflate(R.layout.invitation_report_dialog,
                null);
        respotInvitationDialog = new Dialog(this, R.style.transparentFrameWindowStyle);
        respotInvitationDialog.setContentView(view, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT,
                ViewGroup.LayoutParams.WRAP_CONTENT));
        Window window = respotInvitationDialog.getWindow();
        // 设置显示动画
        window.setWindowAnimations(R.style.main_menu_animstyle);
        WindowManager.LayoutParams wl = window.getAttributes();
        wl.x = 0;
        wl.y = getWindowManager().getDefaultDisplay().getHeight();
        // 以下这两句是为了保证按钮可以水平满屏
        wl.width = ViewGroup.LayoutParams.MATCH_PARENT;
        wl.height = ViewGroup.LayoutParams.WRAP_CONTENT;

        // 设置显示位置
        respotInvitationDialog.onWindowAttributesChanged(wl);
        // 设置点击外围解散
        respotInvitationDialog.setCanceledOnTouchOutside(true);
        respotInvitationDialog.show();
    }

    /*广告垃圾的举报---帖子的*/
    public void invitition_advertising_grabage(View view) {
        InInvitationform(uid, id, 2 + "", 1 + "");
    }

    /*色情淫秽的举报--帖子的*/
    public void invitition_plagiarize(View view) {
        InInvitationform(uid, id, 2 + "", 2 + "");
    }

    /*恶意营销*/
    public void invitition_hostility(View view) {
        InInvitationform(uid, id, 2 + "", 3 + "");
    }

    /*人身攻击*/
    public void invitition_other(View view) {
        InInvitationform(uid, id, 2 + "", 4 + "");
    }

    /*取消*/
    public void invitition_report_cancel(View view) {
        respotInvitationDialog.cancel();
    }

    /*举报的接口-----可以举报帖子--可以举报圈子-=------inform(是圈子还是帖子)--- type(是举报的类型)*/
    private void InInvitationform(String toUid, String ObjectId, String inFormTyoe, String type) {
        Home_AllAtten_Server home_allAtten_server = ApiWrapper.getInstance().create(Home_AllAtten_Server.class);
        Call<MyAttentionInformBean> myAttentionInformBeanCall = home_allAtten_server.postInform(token, toUid, ObjectId, inFormTyoe, type);
        myAttentionInformBeanCall.enqueue(new Callback<MyAttentionInformBean>() {
            @Override
            public void onResponse(Call<MyAttentionInformBean> call, Response<MyAttentionInformBean> response) {
                MyAttentionInformBean body = response.body();
                if (body != null) {
                    int code = body.getCode();
                    if (code == 1) {
                        if (downDialog != null) {
                            downDialog.cancel();
                        }
                        if (respotInvitationDialog != null) {
                            respotInvitationDialog.cancel();
                        }

                        if (respotCommentDialog != null) {
                            respotCommentDialog.cancel();
                        }
                        MyToast.showToast(activity, "举报成功，等待审核", Toast.LENGTH_SHORT);
                    } else if (code == 0) {
                        showLoginDoalog();
                    } else if (code == 2900) {
                        MyToast.showToast(activity, "需要登陆后才可以操作", Toast.LENGTH_SHORT);
                    } else if (code == 2901) {
                        MyToast.showToast(activity, "抱歉您的账户被暂时限制了，无法进行此操作", Toast.LENGTH_SHORT);
                    } else if (code == 2902) {

                    } else if (code == 2904) {
                        MyToast.showToast(activity, "系统繁忙请稍后再试！", Toast.LENGTH_SHORT);
                    }
                }
            }

            @Override
            public void onFailure(Call<MyAttentionInformBean> call, Throwable t) {
                MyToast.showToast(activity, "系统繁忙请稍后再试！", Toast.LENGTH_SHORT);
            }
        });
    }

    /*判断来自按钮是否加入书圈*/
    private void JudgeWheTherJoin() {
        JudgeWhetherJoin judgeWhetherJoin = ApiWrapper.getInstance().create(JudgeWhetherJoin.class);
        Call<JudgeWhetherJoinBean> join = judgeWhetherJoin.getJoin(token, object_id);
        join.enqueue(new Callback<JudgeWhetherJoinBean>() {
            @Override
            public void onResponse(Call<JudgeWhetherJoinBean> call, Response<JudgeWhetherJoinBean> response) {
                JudgeWhetherJoinBean body = response.body();
                if (body != null) {
                    int code = body.getCode();
                    if (code == 1) {
                        intent.setClass(activity, Help_FeedBack_Activity.class);
                        String circleId = info.getObject_id();
                        String title = info.getTitle();
                        String uid = info.getUid();
                        intent.putExtra("login_find_uid", uid);
                        intent.putExtra("circleId", circleId);
                        intent.putExtra("circleName", title);
                        startActivity(intent);
                    } else if (code == 0) {
                        //token 錯誤或則失效
                        showLoginDoalog();
                    } else if (code == 1600) {
                        //需要用户登陆后才可以操作
                        showLoginDoalog();
                    } else if (code == 1601) {
                        /*用户并没有加入该圈子*/
                        String circleId = info.getObject_id();
                        intent.setClass(activity, CircleFindDetailActivity.class);
                        intent.putExtra("circle_find_id", circleId);
                        startActivity(intent);
                    }
                }
            }

            @Override
            public void onFailure(Call<JudgeWhetherJoinBean> call, Throwable t) {
                MyToast.showToast(activity, "网络异常，请稍后重试", Toast.LENGTH_SHORT);
            }
        });
    }

    /*加入圈子的钮*/
    private void JoinCircle() {
        String token = AbSharedUtil.getString(activity, SharedConstants.USER_TOKEN);
        JoinCircleServer joinCircleServer = ApiWrapper.getInstance().create(JoinCircleServer.class);
        Call<JoinCircleBean> joinBean = joinCircleServer.getJoinBean(token, Integer.parseInt(object_id), 1, 1);
        joinBean.enqueue(new Callback<JoinCircleBean>() {
            @Override
            public void onResponse(Call<JoinCircleBean> call, Response<JoinCircleBean> response) {
                JoinCircleBean body = response.body();
                if (body != null) {
                    int code = body.getCode();
                    if (code == 1) {
                        MyToast.showToast(activity, "加入圈子成功", Toast.LENGTH_SHORT);
                    } else if (code == 0) {
                        MyToast.showToast(activity, "请登陆", Toast.LENGTH_SHORT);
                    } else if (code == 2500) {
                        MyToast.showToast(activity, "需要登陆后才可以操作", Toast.LENGTH_SHORT);
                    } else if (code == 2501) {
                        MyToast.showToast(activity, "不存在该书圈", Toast.LENGTH_SHORT);
                    } else if (code == 2502) {
                        MyToast.showToast(activity, "您已经收藏过了！", Toast.LENGTH_SHORT);
                    } else if (code == 2506) {
                        MyToast.showToast(activity, "抱歉您的账户被暂时限制了，无法进行此操作", Toast.LENGTH_SHORT);
                    } else if (code == 2507) {
                        MyToast.showToast(activity, "系统繁忙，请您稍后再试！", Toast.LENGTH_SHORT);
                    }
                }
            }

            @Override
            public void onFailure(Call<JoinCircleBean> call, Throwable t) {
                MyToast.showToast(activity, "系统繁忙，请您稍后再试！", Toast.LENGTH_SHORT);
            }
        });
    }

    /*右上角来自的dialog----我的圈子*/
    private Dialog fromDailog;

    private void showFromDialog() {
        View view = getLayoutInflater().inflate(R.layout.invitation_from_dialog,
                null);
        fromDailog = new Dialog(this, R.style.transparentFrameWindowStyle);
        this.fromDailog.setContentView(view, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT,
                ViewGroup.LayoutParams.WRAP_CONTENT));
        Window window = this.fromDailog.getWindow();
        // 设置显示动画
        window.setWindowAnimations(R.style.main_menu_animstyle);
        WindowManager.LayoutParams wl = window.getAttributes();
        wl.x = 0;
        wl.y = getWindowManager().getDefaultDisplay().getHeight();
        // 以下这两句是为了保证按钮可以水平满屏
        wl.width = ViewGroup.LayoutParams.MATCH_PARENT;
        wl.height = ViewGroup.LayoutParams.WRAP_CONTENT;

        // 设置显示位置
        this.fromDailog.onWindowAttributesChanged(wl);
        // 设置点击外围解散
        this.fromDailog.setCanceledOnTouchOutside(true);
        this.fromDailog.show();
    }

    /*来自我的圈子的dailog的取消*/
    public void from_cancel(View view) {
        fromDailog.cancel();

    }

    /*来自dailog的分享*/
    public void btn_share(View view) {
        showShare();
    }

    /*来自dailog的编辑书圈*/
    public void btn_edite_circle(View view) {
        editCircle();
    }

    /*编辑书圈*/
    private void editCircle() {
        intent.setClass(MyAttentionActivity.this, EditCircleActivity.class);
        intent.putExtra("circle_id", object_id);
        startActivity(intent);
        fromDailog.cancel();
    }

    /*来自dailog的成员管理*/
    public void btn_member_manage(View view) {
        intent.setClass(MyAttentionActivity.this, MenberMangeMentActivity.class);
        intent.putExtra("object_id", object_id);
        intent.putExtra("myattention", uid);
        startActivity(intent);
        fromDailog.cancel();
        MyToast.showToast(activity, "成员管理", Toast.LENGTH_SHORT);
    }

    /*右上角来自的dialog----别人的圈子*/
    private Dialog otherPeopleDialog;

    private void showFromOtherPeopleDialog() {
        View view = getLayoutInflater().inflate(R.layout.invitation_from_otherpeople_dialog,
                null);
        otherPeopleDialog = new Dialog(this, R.style.transparentFrameWindowStyle);
        this.otherPeopleDialog.setContentView(view, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT,
                ViewGroup.LayoutParams.WRAP_CONTENT));
        Window window = this.otherPeopleDialog.getWindow();
        // 设置显示动画
        window.setWindowAnimations(R.style.main_menu_animstyle);
        WindowManager.LayoutParams wl = window.getAttributes();
        wl.x = 0;
        wl.y = getWindowManager().getDefaultDisplay().getHeight();
        // 以下这两句是为了保证按钮可以水平满屏
        wl.width = ViewGroup.LayoutParams.MATCH_PARENT;
        wl.height = ViewGroup.LayoutParams.WRAP_CONTENT;

        // 设置显示位置
        this.otherPeopleDialog.onWindowAttributesChanged(wl);
        // 设置点击外围解散
        this.otherPeopleDialog.setCanceledOnTouchOutside(true);
        this.otherPeopleDialog.show();
    }

    /*来自其他人的圈子的dailog的取消*/
    public void otherpeople_cancel(View view) {
        otherPeopleDialog.cancel();
    }

    /*来自其他人的圈子的dailog的分享*/
    public void btn_otherpeople_share(View view) {
        showShare();
    }

    private void showShare() {
        OnekeyShare oks = new OnekeyShare();
        //关闭sso授权
        oks.disableSSOWhenAuthorize();
        oks.setSilent(false);
        oks.setDialogMode();
        // title标题，印象笔记、邮箱、信息、微信、人人网、QQ和QQ空间使用
        oks.setTitle("文鱼阅读");
        // titleUrl是标题的网络链接，仅在Linked-in,QQ和QQ空间使用
        // oks.setTitleUrl("http://sharesdk.cn");
        // text是分享文本，所有平台都需要这个字段
        // oks.setText(content);
        //分享网络图片，新浪微博分享网络图片需要通过审核后申请高级写入接口，否则请注释掉测试新浪微博
        oks.setImageUrl("http://www.iwenyu.cn/Public/images/share.jpg");
        // imagePath是图片的本地路径，Linked-In以外的平台都支持此参数
        //oks.setImagePath("/sdcard/test.jpg");//确保SDcard下面存在此张图片
        // url仅在微信（包括好友和朋友圈）中使用
        // oks.setUrl("http://sharesdk.cn");
        // comment是我对这条分享的评论，仅在人人网和QQ空间使用
        oks.setComment("我是测试评论文本");
        // site是分享此内容的网站名称，仅在QQ空间使用
        oks.setSite("ShareSDK");
        // siteUrl是分享此内容的网站地址，仅在QQ空间使用
        oks.setSiteUrl("http://sharesdk.cn");

        // 启动分享GUI
        oks.show(this);
    }


    /*来自其他人的圈子的dailog的举报*/
    public void btn_report_otherpeople_circle(View view) {
        reportDialog();
    }

    /*来自其他人的圈子的dailog的查看书圈*/
    public void btn_examine_circle(View view) {
        intent.setClass(activity, ExamineCircleActivity.class);
        intent.putExtra("helpfeedbackactivity_to_examinactivity", object_id);
        startActivity(intent);
        otherPeopleDialog.cancel();
    }

    /*来自其他人的圈子的dailog的退出圈子*/
    public void btn_quit_circle_manage(View view) {
        quietCollect();
    }

    /*退出书圈*/
    private void quietCollect() {
        JoinCircleServer joinCircleServer = ApiWrapper.getInstance().create(JoinCircleServer.class);
        Call<JoinCircleBean> joinBean = joinCircleServer.getJoinBean(token, Integer.parseInt(object_id), 1, 2);
        joinBean.enqueue(new Callback<JoinCircleBean>() {
            @Override
            public void onResponse(Call<JoinCircleBean> call, Response<JoinCircleBean> response) {
                JoinCircleBean body = response.body();
                if (body != null) {
                    int code = body.getCode();
                    if (code == 1) {
                        MyToast.showToast(activity, "退出书圈成功", Toast.LENGTH_SHORT);
                        otherPeopleDialog.cancel();
                    } else if (code == 0) {
                        showLoginDoalog();
                    } else if (code == 2500) {
                        MyToast.showToast(activity, "需要登陆后才可以操作", Toast.LENGTH_SHORT);
                    } else if (code == 2503) {
                        MyToast.showToast(activity, "您已经取消过对该书圈的收藏了！", Toast.LENGTH_SHORT);
                    } else if (code == 2504) {
                        MyToast.showToast(activity, "您还没有收藏过该书圈！", Toast.LENGTH_SHORT);
                    } else if (code == 2506) {
                        MyToast.showToast(activity, "抱歉您的账户被暂时限制了，无法进行此操作！", Toast.LENGTH_SHORT);
                    } else if (code == 2507) {
                        MyToast.showToast(activity, "系统繁忙，请您稍后再试！", Toast.LENGTH_SHORT);
                    }
                }
            }

            @Override
            public void onFailure(Call<JoinCircleBean> call, Throwable t) {
                MyToast.showToast(activity, "系统繁忙，请您稍后再试！", Toast.LENGTH_SHORT);
            }
        });

    }

    /*举报的列表---圈子的*/
    private Dialog respotDialog;

    private void reportDialog() {
        View view = getLayoutInflater().inflate(R.layout.circle_report_dialog,
                null);
        respotDialog = new Dialog(this, R.style.transparentFrameWindowStyle);
        respotDialog.setContentView(view, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT,
                ViewGroup.LayoutParams.WRAP_CONTENT));
        Window window = respotDialog.getWindow();
        // 设置显示动画
        window.setWindowAnimations(R.style.main_menu_animstyle);
        WindowManager.LayoutParams wl = window.getAttributes();
        wl.x = 0;
        wl.y = getWindowManager().getDefaultDisplay().getHeight();
        // 以下这两句是为了保证按钮可以水平满屏
        wl.width = ViewGroup.LayoutParams.MATCH_PARENT;
        wl.height = ViewGroup.LayoutParams.WRAP_CONTENT;

        // 设置显示位置
        respotDialog.onWindowAttributesChanged(wl);
        // 设置点击外围解散
        respotDialog.setCanceledOnTouchOutside(true);
        respotDialog.show();
    }

    /*举报*/
    public void advertising_grabage(View view) {
        InCircleform(uid, object_id, 1 + "", 1 + "");
    }

    public void plagiarize(View view) {
        InCircleform(uid, object_id, 1 + "", 2 + "");
    }

    public void hostility(View view) {
        InCircleform(uid, object_id, 1 + "", 3 + "");
    }

    public void other(View view) {
        InCircleform(uid, object_id, 1 + "", 4 + "");
    }

    public void report_cancel(View view) {
        respotDialog.cancel();
    }

    /*举报的接口-----可以举报帖子--可以举报圈子-=------inform(是圈子还是帖子)--- type(是举报的类型)*/
    private void InCircleform(String toUid, String ObjectId, String inFormTyoe, String type) {
        Home_AllAtten_Server home_allAtten_server = ApiWrapper.getInstance().create(Home_AllAtten_Server.class);
        Call<MyAttentionInformBean> myAttentionInformBeanCall = home_allAtten_server.postInform(token, toUid, ObjectId, inFormTyoe, type);
        myAttentionInformBeanCall.enqueue(new Callback<MyAttentionInformBean>() {
            @Override
            public void onResponse(Call<MyAttentionInformBean> call, Response<MyAttentionInformBean> response) {
                MyAttentionInformBean body = response.body();
                if (body != null) {
                    int code = body.getCode();
                    if (code == 1) {
                        if (otherPeopleDialog != null && respotDialog != null) {
                            MyToast.showToast(activity, "举报成功，等待审核", Toast.LENGTH_SHORT);
                            otherPeopleDialog.cancel();
                            respotDialog.cancel();
                        }
                    } else if (code == 0) {
                        showLoginDoalog();
                    } else if (code == 2900) {
                        MyToast.showToast(activity, "需要登陆后才可以操作", Toast.LENGTH_SHORT);
                    } else if (code == 2901) {
                        MyToast.showToast(activity, "抱歉您的账户被暂时限制了，无法进行此操作", Toast.LENGTH_SHORT);
                    } else if (code == 2902) {

                    } else if (code == 2904) {
                        MyToast.showToast(activity, "系统繁忙请稍后再试！", Toast.LENGTH_SHORT);
                    }
                }
            }

            @Override
            public void onFailure(Call<MyAttentionInformBean> call, Throwable t) {
                MyToast.showToast(activity, "系统繁忙请稍后再试！", Toast.LENGTH_SHORT);
            }
        });
    }

    /*调起微信支付*/
    private void playtourData(String WXMoney) {
        if (WXMoney != null) {
            WXPlayServer wxPlayServer = ApiWrapper.getInstance().create(WXPlayServer.class);
            Call<WXPlayBean> wxPlay = wxPlayServer.getWxPlay(token, uid, id, 2 + "", WXMoney);
            // Call<WXPlayBean> wxPlay = wxPlayServer.getWxPlay("475331a2b6dc0beeda9ae881c3229c14", 186 + "",125 + "",2 + "",0.01 + "");
            wxPlay.enqueue(new Callback<WXPlayBean>() {
                @Override
                public void onResponse(Call<WXPlayBean> call, Response<WXPlayBean> response) {
                    WXPlayBean body = response.body();
                    if (body != null) {
                        int code = body.getCode();
                        String msg = body.getMsg();
                        if (code == 1) {
                            PayReq req = new PayReq();
                            req.appId = body.getInfo().getAppid();//appid
                            req.partnerId = body.getInfo().getPartnerid();//商户号
                            req.prepayId = body.getInfo().getPrepayid();//预支付回话id
                            req.nonceStr = body.getInfo().getNoncestr();//随机字符串
                            req.timeStamp = body.getInfo().getTimestamp();//时间戳
                            req.packageValue = "Sign=WXPay";//固定值
                            req.sign = body.getInfo().getSign();
                            msgApi.sendReq(req);
                            if (costomMoneyDialog != null) {
                                costomMoneyDialog.cancel();
                            }
                            if (playtourDialog != null) {
                                playtourDialog.cancel();
                            }
                        } else if (code == 7007) {
                            MyToast.showToast(activity, msg, Toast.LENGTH_SHORT);
                        } else if (code == 7005) {
                            MyToast.showToast(activity, msg, Toast.LENGTH_SHORT);
                        } else if (code == 7004) {
                            MyToast.showToast(activity, msg, Toast.LENGTH_SHORT);
                        } else if (code == 7003) {
                            MyToast.showToast(activity, msg, Toast.LENGTH_SHORT);
                        } else if (code == 7002) {
                            MyToast.showToast(activity, msg, Toast.LENGTH_SHORT);
                        } else if (code == 7001) {
                            MyToast.showToast(activity, msg, Toast.LENGTH_SHORT);
                        } else if (code == 7000) {
                            MyToast.showToast(activity, msg, Toast.LENGTH_SHORT);
                        } else if (code == 0) {
                            showLoginDoalog();
                        }
                    }
                }

                @Override
                public void onFailure(Call<WXPlayBean> call, Throwable t) {
                    MyToast.showToast(activity, "网络异常，请稍后重试", Toast.LENGTH_SHORT);
                }
            });
        }
    }

    AlertDialog adCircle;
    private TextView quxiaoCircle;
    private TextView quedingCircle;

    /*显示提示用户退出的dialog*/
    private void judgeJoinCircle() {
        adCircle = new AlertDialog.Builder(MyAttentionActivity.this).create();
        adCircle.show();
        Window window = adCircle.getWindow();
        window.setContentView(R.layout.judge_circlejoin_dailog);
        quxiaoCircle = (TextView) window.findViewById(R.id.dialog_login_quxiao);
        quedingCircle = (TextView) window.findViewById(R.id.dialog_login_queding);
        quxiaoCircle.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                adCircle.dismiss();
            }
        });
        quedingCircle.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                JiaRuCircle();
            }
        });
    }


    /*加入圈子的钮*/
    private void JiaRuCircle() {
        String token = AbSharedUtil.getString(activity, SharedConstants.USER_TOKEN);
        JoinCircleServer joinCircleServer = ApiWrapper.getInstance().create(JoinCircleServer.class);
        Call<JoinCircleBean> joinBean = joinCircleServer.getJoinBean(token, Integer.parseInt(object_id), 1, 1);
        joinBean.enqueue(new Callback<JoinCircleBean>() {
            @Override
            public void onResponse(Call<JoinCircleBean> call, Response<JoinCircleBean> response) {
                JoinCircleBean body = response.body();
                if (body != null) {
                    int code = body.getCode();
                    if (code == 1) {
                        adCircle.dismiss();
                        MyToast.showToast(activity, "加入圈子成功", Toast.LENGTH_SHORT);
                    } else if (code == 0) {
                        MyToast.showToast(activity, "请登陆", Toast.LENGTH_SHORT);
                    } else if (code == 2500) {
                        MyToast.showToast(activity, "需要登陆后才可以操作", Toast.LENGTH_SHORT);
                    } else if (code == 2501) {
                        MyToast.showToast(activity, "不存在该书圈", Toast.LENGTH_SHORT);
                    } else if (code == 2502) {
                        MyToast.showToast(activity, "您已经收藏过了！", Toast.LENGTH_SHORT);
                    } else if (code == 2506) {
                        MyToast.showToast(activity, "抱歉您的账户被暂时限制了，无法进行此操作", Toast.LENGTH_SHORT);
                    } else if (code == 2507) {
                        MyToast.showToast(activity, "系统繁忙，请您稍后再试！", Toast.LENGTH_SHORT);
                    }
                }
            }

            @Override
            public void onFailure(Call<JoinCircleBean> call, Throwable t) {
                MyToast.showToast(activity, "系统繁忙，请您稍后再试！", Toast.LENGTH_SHORT);
            }
        });
    }
}
